【问题标题】:how to find the swagger path如何找到招摇的路径
【发布时间】: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


【解决方案1】:

您可以使用以下方法:

  1. 使用命令-npm install -g http-server在节点包http-server上全局安装
  2. 将目录更改为your.json 所在位置后运行http-server --cors
  3. 打开 swagger ui(即 dist/index.html)
  4. 在输入框中输入http://localhost:8080/your.json,然后点击“探索”

【讨论】:

    猜你喜欢
    • 2021-07-08
    • 2021-01-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多