支持swagger-bootstrap插件

This commit is contained in:
tanghc
2019-08-09 16:22:22 +08:00
parent 96e47407f0
commit 273f3c97d7
3 changed files with 14 additions and 19 deletions

View File

@@ -29,6 +29,10 @@ public abstract class SwaggerSupport {
@Bean
public Docket createRestApi() {
return getDocket();
}
protected Docket getDocket() {
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()

View File

@@ -79,22 +79,11 @@
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>2.9.2</version>
<exclusions>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.swagger</groupId>
<artifactId>swagger-models</artifactId>
<version>1.5.21</version>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>2.9.2</version>
<groupId>com.github.xiaoymin</groupId>
<artifactId>swagger-bootstrap-ui</artifactId>
<version>1.9.5</version>
</dependency>
<dependency>

View File

@@ -22,10 +22,11 @@ public class OpenServiceConfig extends AlipayServiceConfiguration {
@Override
protected void addResourceHandlers(ResourceHandlerRegistry registry) {
super.addResourceHandlers(registry);
registry.addResourceHandler("swagger-ui.html")
.addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**")
.addResourceLocations("classpath:/META-INF/resources/webjars/");
// 支持swagger-bootstrap-ui首页
registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
// 支持默认swagger
registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
}
@@ -43,9 +44,10 @@ public class OpenServiceConfig extends AlipayServiceConfiguration {
@Override
protected boolean swaggerAccessProtected() {
return true;
return false;
}
}
}
/**