Spring Boot 2.0系列教程(二) Hello Wor
2018-01-18 本文已影响18人
zheting
在《Spring Boot 2.0系列教程(一) 使用IDEA生成Spring Boot 项目》基础上修改build.gradle中依赖为web即可
compile('org.springframework.boot:spring-boot-starter-web')
新增一个类:
@RestController
public class Example {
@RequestMapping("/")
String home() {
return "Hello World!";
}
}
启动以后访问8080端口,就会返回Hello World!
