SpringBoot設置項目訪問路徑

    今天配置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  #設置項目訪問路徑
相關文章
相關標籤/搜索