SpringBoot配置项目访问路径server.context-path不生效

在使用springboot时,在application.properties中配置了server.context-path=/test,如图:
在这里插入图片描述
启动项目:
在这里插入图片描述
发现端口生效为8084 ,而context path为空
检查springboot版本为2.2.4,SpringBoot在2.0版本之后已经弃用server.context-path,而代替为server.servlet.context-path
所以更换配置:

server.servlet.context-path=/test 

重启:
在这里插入图片描述
访问路径配置成功。

猜你喜欢

转载自blog.csdn.net/quanqxj/article/details/104211311