spring boot默认是/ ,这样直接通过http://ip:port/就可以访问到index页面,如果要修改为http://ip:port/path/ 访问的话,那么需要在application.properties文件中加入server.context-path= /你的path,比如:spring-boot,那么访问地址就是http://ip:port/spring-boot路径。
profile配置:
server.context-path=/spring-boot
yml文件配置
server context-apth: /spring-boot
在IDEA 中配置如下
更新到2.0后写法变成了server.servlet.context-path=/XXXXXX (没试过)