测试配置:
# 三种不同版本springboot中 应用名的配置方法
spring.application.name=ms1
server.context-path=/ms2
server.servlet.context-path=/ms3
server.port=8888
启动应用,其中一行日志为:
o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8888 (http) with context path '/ms3'
而我当前的SpringBoot依赖版本:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.5.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
所以最终留下的配置为:
server.servlet.context-path=/ms3
server.port=8888
- 不同版本SpringBoot与应用名的配置项对应关系
待补全
配置项 | 已测试版本 | comment |
---|---|---|
spring.application.name | – | 字符串 |
server.context-path | – | /开头的字符串 |
server.servlet.context-path | 2.5.0 2.5.1 | /开头的字符串 |