Commit 58882d32 by ljb

解决swagger不生效

parent b089d7e6
package com.zq.dataoperation.config; package com.zq.dataoperation;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
...@@ -13,7 +13,6 @@ import springfox.documentation.spring.web.plugins.Docket; ...@@ -13,7 +13,6 @@ import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2; import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Profile("dev")
@Configuration @Configuration
@EnableSwagger2 @EnableSwagger2
public class Swagger { public class Swagger {
...@@ -25,7 +24,7 @@ public class Swagger { ...@@ -25,7 +24,7 @@ public class Swagger {
public Docket api() { public Docket api() {
return new Docket(DocumentationType.SWAGGER_2) return new Docket(DocumentationType.SWAGGER_2)
.groupName("admin") .groupName("admin")
// .enable(!"product".equals(profile)) //生产环境关闭 .enable(!"prod".equals(profile)) //生产环境关闭
.select() .select()
.apis(RequestHandlerSelectors.basePackage("com.zq.dataoperation.controller")) .apis(RequestHandlerSelectors.basePackage("com.zq.dataoperation.controller"))
.paths(PathSelectors.any()) .paths(PathSelectors.any())
...@@ -44,7 +43,7 @@ public class Swagger { ...@@ -44,7 +43,7 @@ public class Swagger {
public Docket app() { public Docket app() {
return new Docket(DocumentationType.SWAGGER_2) return new Docket(DocumentationType.SWAGGER_2)
.groupName("app") .groupName("app")
.enable(!"product".equals(profile)) //生产环境关闭 .enable(!"prod".equals(profile)) //生产环境关闭
.select() .select()
.apis(RequestHandlerSelectors.basePackage("com.zq.dataoperation.controller.api")) .apis(RequestHandlerSelectors.basePackage("com.zq.dataoperation.controller.api"))
.paths(PathSelectors.any()) .paths(PathSelectors.any())
...@@ -58,5 +57,4 @@ public class Swagger { ...@@ -58,5 +57,4 @@ public class Swagger {
.description("查看接口文档") .description("查看接口文档")
.build(); .build();
} }
} }
\ No newline at end of file
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