【发布时间】:2019-05-21 17:06:45
【问题描述】:
我有以下招摇配置。现在我在浏览器中打开 swagger-ui 的招摇路径是什么。
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.regex(".*/v2/accounts/.*"))
.build()
.securitySchemes(Collections.singletonList(apiKey()))
.securityContexts(Collections.singletonList(securityContext()));
【问题讨论】:
-
应该可以从应用启动日志中获取到swagger-ui路径。通常它以 swagger-ui.html 结尾。在您的情况下,路径类似于
/v2/accounts/swagger-ui.html 例如localhost:8080/v2/accounts/swagger-ui.html -
这是 swagger url 通常的样子:localhost:8080/<APP_Context>/swagger-ui.html
-
是的,我知道它应该有路径 localhost:8080/APP_CONTEXT/swagger-ui.html。但唯一的问题是我无法获得 CONTEXT_PATH 本身。 localhost:8080/v2/accounts/swagger-ui.html - 这不起作用@Akash
-
@GauravYadav 你的控制器映射是什么?你的 application.config 中是否也有任何 server.context-path 设置?
-
实际上,我是这个项目的新手,我在 application.cofig 中看不到任何 server.context-path。而且这个项目使用的是ANT构建系统,所以没有application.config。也没有控制器映射。
标签: spring-mvc swagger-ui swagger-2.0