11. 配置ContextPath【从零开始学Spring Boot】

Springboot默认访问路径为/,若要改为如http://ip:port/path/,需在Application.properties中添加`server.context-path=/你的path`,例如设为spring-boot,则访问路径变为http://ip:port/spring-boot。其他可配置选项包括服务器端口、会话超时时间等。
摘要由CSDN通过智能技术生成

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

server.context-path=/spring-boot

常用配置:

########################################################

###EMBEDDED SERVER CONFIGURATION (ServerProperties)

########################################################

#server.port=8080

#server.address= # bind to a specific NIC

#server.session-timeout= # session timeout in seconds

#the context path, defaults to '/'

#server.context-path=/spring-boot

#server.servlet-path= # the servlet path, defaults to '/'

#server.tomcat.access-log-pattern= # log pattern of the access log

#server.tomcat.access-log-enabled=false # is access logging enabled

#server.tomcat.protocol-header=x-forwarded-proto # ssl forward headers

#server.tomcat.remote-ip-header=x-forwarded-for

#server.tomcat.basedir=/tmp # base dir (usually not needed, defaults totmp)

。。。。。。。。。。。。。。。。。

版权原因,完整文章,请参考如下:11. 配置ContextPath【从零开始学Spring Boot】

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值