From 9c7f5f394387099037d4af06f7abefc1b78628ea Mon Sep 17 00:00:00 2001 From: nidapeng <jp@doumee.com> Date: 星期四, 25 四月 2024 15:45:42 +0800 Subject: [PATCH] 最新版本 --- server/visits/dmvisit_web/src/main/java/com/doumee/config/swagger/SwaggerConfig.java | 45 +++++++++++++++++++++------------------------ 1 files changed, 21 insertions(+), 24 deletions(-) diff --git a/server/visits/dmvisit_web/src/main/java/com/doumee/config/swagger/SwaggerConfig.java b/server/visits/dmvisit_web/src/main/java/com/doumee/config/swagger/SwaggerConfig.java index 2b6e8f7..c8f9c2c 100644 --- a/server/visits/dmvisit_web/src/main/java/com/doumee/config/swagger/SwaggerConfig.java +++ b/server/visits/dmvisit_web/src/main/java/com/doumee/config/swagger/SwaggerConfig.java @@ -8,17 +8,12 @@ import org.springframework.context.annotation.Configuration; import springfox.documentation.RequestHandler; import springfox.documentation.builders.ApiInfoBuilder; -import springfox.documentation.builders.ParameterBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.oas.annotations.EnableOpenApi; -import springfox.documentation.schema.ModelRef; import springfox.documentation.service.ApiInfo; -import springfox.documentation.service.Parameter; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spring.web.plugins.Docket; -import java.util.ArrayList; -import java.util.List; import java.util.function.Predicate; /** @@ -51,40 +46,42 @@ .version(version) .build(); } - @Bean - public Docket getDocket3() { + /* @Bean + public Docket getDocket() { return new Docket(DocumentationType.SWAGGER_2) - .apiInfo(this.getApiInfo()).groupName("銆愬皬绋嬪簭鎺ュ彛API銆�") + .apiInfo(this.getApiInfo()).groupName("銆愮郴缁熺鐞嗘帴鍙PI銆�") .host(host) .select() - .apis( basePackage("com.doumee.api.web")) + .apis( basePackage("com.doumee.api.system;")) // 璁剧疆闇�瑕佽鎵弿鐨勭被锛岃繖閲岃缃负娣诲姞浜咢Api娉ㄨВ鐨勭被 // .apis(RequestHandlerSelectors.withClassAnnotation(Api.class)) .paths(PathSelectors.any()) - .build() - .globalOperationParameters(this.getParameterList()); - } - - private List<Parameter> getParameterList() { - ParameterBuilder tokenPar = new ParameterBuilder(); - List<Parameter> pars = new ArrayList<>(); - tokenPar.name("token").description("浠ょ墝").modelRef(new ModelRef("string")).defaultValue("璁剧疆token榛樿鍊�").modelRef(new ModelRef("string")).parameterType("header").required(false).build(); - pars.add(tokenPar.build()); - return pars; - } - + .build(); + }*/ @Bean - public Docket getDocket1() { + public Docket getDocket2() { return new Docket(DocumentationType.SWAGGER_2) - .apiInfo(this.getApiInfo()).groupName("銆愬叕鍏辨帴鍙PI銆�") + .apiInfo(this.getApiInfo()).groupName("default") .host(host) .select() - .apis( basePackage("com.doumee.api.common")) + .apis( basePackage("com.doumee.api.system;com.doumee.api.business;com.doumee.api.common")) // 璁剧疆闇�瑕佽鎵弿鐨勭被锛岃繖閲岃缃负娣诲姞浜咢Api娉ㄨВ鐨勭被 // .apis(RequestHandlerSelectors.withClassAnnotation(Api.class)) .paths(PathSelectors.any()) .build(); } + /* @Bean + public Docket getDocket1() { + return new Docket(DocumentationType.SWAGGER_2) + .apiInfo(this.getApiInfo()).groupName("銆愬叕鍏辨帴鍙PI銆�") + .host(host) + .select() + .apis( basePackage("com.doumee.api.common")) + // 璁剧疆闇�瑕佽鎵弿鐨勭被锛岃繖閲岃缃负娣诲姞浜咢Api娉ㄨВ鐨勭被 +// .apis(RequestHandlerSelectors.withClassAnnotation(Api.class)) + .paths(PathSelectors.any()) + .build(); + }*/ /** * 閲嶅啓basePackage鏂规硶锛屼娇鑳藉瀹炵幇澶氬寘璁块棶锛屽鍒惰创涓婂幓 * @author teavamc -- Gitblit v1.9.3