一、搭建
1.创建一个maven项目:new -> project ->maven,填好项目各种ID、项目名,点finish
2.修改pom.xml
1)引入springboot
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.10.RELEASE</version>
</parent>
2)引入web依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
完成收工~
二、测试
1.写controller
@Controller
public class HelloController {
@ResponseBody
@RequestMapping(value="/hello")
public String hello() {
return "hello world!";
}
}
2.提供项目启动入口(Application)
@SpringBootApplication
public class App {
public static void main( String[] args ) {
SpringApplication.run(App.class);
}
}
3.浏览器输入http:localhost:8080/hello查看