小编Nav*_*dra的帖子

无法从spring-boot应用程序中调出swagger-ui

我有一个使用嵌入式tomcat服务器运行的spring启动应用程序.我部分成功地将springfox-swagger与应用程序集成在一起.如果我执行/ v2/api-docs,我可以在webapp中查看所有api的所有文档.但是,当我尝试从UI访问相同时,它不起作用.以下是详细结果.

输出 - localhost:8080/api/swagger-resources

[ {
  "name" : "default",
  "location" : "/v2/api-docs",
  "swaggerVersion" : "2.0"
} ]
Run Code Online (Sandbox Code Playgroud)

输出 - localhost:8080/api/v2/api-docs

I get valid results. I can confirm that and the output is too large to paste here
Run Code Online (Sandbox Code Playgroud)

但是当我尝试访问swagger-ui时,它不起作用.下面是我调用以访问swagger-ui的不同URL.

http://localhost:8080/swagger-ui.html - UI is loading, but no documentation of API's is present
http://localhost:8080/api/swagger-ui.html  - 404 Not Found
http://localhost:8080/springfox - 404 Not Found
http://localhost:8080/api/springfox - 404 Not Found
Run Code Online (Sandbox Code Playgroud)

下面是我的SwaggerConfig.java类

package com.vmware.vrack.lcm;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import …
Run Code Online (Sandbox Code Playgroud)

swagger swagger-ui spring-boot swagger-2.0

19
推荐指数
3
解决办法
3万
查看次数

标签 统计

spring-boot ×1

swagger ×1

swagger-2.0 ×1

swagger-ui ×1