上下文路径与 servlet 路径?
http://localhost:8080/context/myServlet
如果您查看映射到路径 /myservlet 的 servlet 的请求 URL,这里 http:// 是协议,localhost 是服务器名称,/context 是上下文路径,/myServlet 是 servlet 路径。
http://localhost:8080/context/myServlet/random
如果您查看映射到路径 /myservlet/* 的 servlet 的请求 URL,这里 /myServlet 是 servlet 路径,/random 是额外路径信息...
参考:https://coderanch.com/t/474573/certification/ContextPath-ServletPath
spring boot 的 tomcat 只能提供该上下文路径下的内容
server.servlet.contextPath=/api/
Dispatcher servlet 路径允许您在其他路径上注册其他 servlet
spring.mvc.servlet.path=/v1
spring.mvc.servlet.path=/v2
两个活跃的调度 servlet:
http://localhost:8081/api/v1 和 http://localhost:8081/api/v2
尝试访问 - http://localhost:8081/api/swagger-ui.html"
对于开放式 API
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-boot-starter</artifactId>
<version>3.0.0</version>
</dependency>
swagger-ui 位置已从
http://host/context-path/swagger-ui.html
到
http://host/context-path/swagger-ui/index.html 或 http://host/context-path/swagger-ui/
简称。
参考https://springfox.github.io/springfox/docs/snapshot/