Commit bc7330a2 by 阳浪

SwaggerConfig

parent 6dcb2866
...@@ -4,6 +4,7 @@ package com.yizhi.application; ...@@ -4,6 +4,7 @@ package com.yizhi.application;
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;
...@@ -19,9 +20,11 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; ...@@ -19,9 +20,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)
......
...@@ -4,6 +4,7 @@ package com.yizhi.system.application; ...@@ -4,6 +4,7 @@ package com.yizhi.system.application;
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;
...@@ -19,9 +20,11 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2; ...@@ -19,9 +20,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)
......
server.port=35000 server.port=35099
spring.application.name=system spring.application.name=system
ACTIVE=${spring.profiles.active} ACTIVE=${spring.profiles.active}
spring.profiles.active=prod spring.profiles.active=prod
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
"JAVA_OPTS": "-Dspring.profiles.active=prod -Dspring.cloud.nacos.config.server-addr=192.168.1.22:3333,192.168.1.22:4444,192.168.1.22:5555" "JAVA_OPTS": "-Dspring.profiles.active=prod -Dspring.cloud.nacos.config.server-addr=192.168.1.22:3333,192.168.1.22:4444,192.168.1.22:5555"
}, },
"sit": { "sit": {
"JAVA_OPTS": "-Dspring.profiles.active=sit -Dspring.cloud.nacos.config.server-addr=192.168.1.13:3333,192.168.1.24:4444,192.168.1.38:5555" "JAVA_OPTS": "-Dspring.profiles.active=sit -Dspring.cloud.nacos.config.server-addr=10.23.1.183:8848"
}, },
"uat": {}, "uat": {},
"prod": {} "prod": {}
......
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