今天配置Springboot项目访问路径遇到一个小坑,这里作一个记录。针对Springboot2.0如下版本和以上版本的配置方式是不一样的。这里针对yml配置文件作记录,properties文件配置方式相同。code
Springboot2.0如下版本不须要配置servlet层server
server: prot: 8080 context-path: /share #设置项目访问路径
Springboot2.0以及以上版本在配置的时候要多加上一层servletxml
server: prot: 8080 servlet: context-path: /share #设置项目访问路径