问题描述
这是我的swagger config的配置类,当我点击http:// localhost:8080 / message-api / v2 / api-docs时,我得到json响应,但是当我点击http:// localhost:8080时/message-api/swagger-ui.html#/我遇到了错误,如果我在https://editor.swagger.io/上转换JSON响应,则可以清楚地看到UI。我已经尝试过很多事情,例如清除浏览器的缓存并清理构建项目很多次,仍然面临问题。
@Configuration
@EnableSwagger2
public class SwaggerConfiguration {
@Bean
public Docket redditCloneApi() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.any())
.paths(PathSelectors.any())
.build()
.apiInfo(getApiInfo());
}
private ApiInfo getApiInfo() {
return new ApiInfoBuilder()
.title("Messgae API")
.version("1.0")
.description("Messgae API Application")
.contact(new Contact("*","*","*"))
.license("Apache License Version 2.0")
.build();
}
}
我也添加了这些依赖项。
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
</dependency>
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)