1、全局配置
修改application.properties
server.port=9999
server.servlet.context-path=/springboot
- server.port=9999表示默认端口号修改为9999
- server.servlet.context-path=/springboot表示访问路径根路径是/springboot
SpringBoot默认是访问根据路径是/ ,这样直接通过http://ip:port/就可以访问,设置server.servlet.context-path后,访问路径更改为http://ip:port/server.servlet.context-path