Commit 957c03f0 by 阳浪

SwaggerConfig

parent b0ca47e1
...@@ -4,6 +4,7 @@ package com.yizhi.logging.config; ...@@ -4,6 +4,7 @@ package com.yizhi.logging.config;
import static com.google.common.base.Predicates.or; import static com.google.common.base.Predicates.or;
import static springfox.documentation.builders.PathSelectors.regex; import static springfox.documentation.builders.PathSelectors.regex;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
...@@ -21,9 +22,11 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; ...@@ -21,9 +22,11 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
@EnableSwagger2 @EnableSwagger2
public class SwaggerConfig { public class SwaggerConfig {
@Value("${swagger.enabled}")
private boolean swaggerEnabled;
@Bean @Bean
public Docket createRestApi() { public Docket createRestApi() {
return new Docket(DocumentationType.SWAGGER_2) return new Docket(DocumentationType.SWAGGER_2).enable(swaggerEnabled)
.groupName("请求日志服务") .groupName("请求日志服务")
.genericModelSubstitutes(DeferredResult.class) .genericModelSubstitutes(DeferredResult.class)
.genericModelSubstitutes(ResponseEntity.class) .genericModelSubstitutes(ResponseEntity.class)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment