在使用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
重啓:
訪問路徑配置成功。