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

profile配置:

server.context-path=/spring-boot

yml文件配置

server
     context-apth: /spring-boot

 

在IDEA 中配置如下

Springboot中添加contextPath

更新到2.0后写法变成了server.servlet.context-path=/XXXXXX (没试过)

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-11-12
  • 2021-12-19
  • 2022-02-21
  • 2022-12-23
  • 2021-06-22
猜你喜欢
  • 2022-12-23
  • 2021-09-28
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-18
  • 2021-10-05
相关资源
相似解决方案