spring boot 读书笔记1-项目工程结构
创建项目
maven配置
alimaven central aliyun maven http://maven.aliyun.com/nexus/content/repositories/central/
项目编码配置
- src/main/java路径:主要编写业务程序
- src/main/resources路径:存放静态文件和配置文件
- src/test/java路径:主要编写测试程序
修改 application.yml 文件中使用 server.port 来人为指定端口,如8001端口:
server: port: 8081
创建controller
@RestController
public class HelloWordController {
@RequestMapping("/hello")
public String hello() {
return "Welcome to the world of Spring Boot!";
}
}
http://127.0.0.1:8081/hello