介绍
上下文路径,是构成 url 地址的一部分,如下:
http://localhost:8080/上下文路径
springboot默认是空,即:http://localhost:8080
springboot1.x 和 springboot2.x 的配置方式不同
springboot1.x
application.yml
server:
context-path: /myblog
此时访问路径为 http://localhost:8080/myblog/ ,后面必须加myblog
application.properties
server.context-path=/blog
springboot2.x
application.yml
server:
servlet:
context-path: /myblog
application.properties
server.servlet.context-path=/blog