SpringBoot随笔记录

SpringBoot中自定义根路径

Spring boot默认是/ ,这样直接通过http://ip:port/就可以访问到index页面。如果要修改为http://ip:port/path/ 访问的话,
那么需要在Application.properties文件中加入server.servlet.context-path = /你的path,比如:demo,那么访问地址就是http://ip:port/demo 路径。
例如:yml文件
server:
  servlet:
    context-path: /demo

猜你喜欢

转载自www.cnblogs.com/mengY/p/11743634.html