简介
Spring Boot来简化Spring应用开发,约定大于配置, 去繁从简。
创建SpringBoot项目
添加依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
写一个最简单的控制器
package com.lglbc.springbootlearning;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class IndexController {
@RequestMapping("/test")
public String hello(){
return "helloWorld";
}
}
运行项目
测试一波
http://localhost:8080/test