問題描述:
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

重啟:訪問路徑配置成功。
