Spring Boot 项目配置文件

1.创建配置文件 src/main/resources/application.properties

server.port=8081
server.servlet.context-path=/test

2.重新运行项目,发现原来的网址无法访问,

这是因为我们刚刚改了访问端口、和访问路径

现在需要访问 http://localhost:8081/test/hello

3.当然我们也可以在 src/main/resources/application.yml 中修改,效果是一样的

3657
0
3年前