copy from server/src/main/java/com/doumee/config/swagger/SwaggerConfig.java
copy to server/web/src/main/java/com/doumee/config/swagger/SwaggerConfig.java
| Îļþ´Ó server/src/main/java/com/doumee/config/swagger/SwaggerConfig.java ¸´ÖÆ |
| | |
| | | import org.springframework.context.annotation.Configuration; |
| | | import springfox.documentation.RequestHandler; |
| | | import springfox.documentation.builders.ApiInfoBuilder; |
| | | import springfox.documentation.builders.ParameterBuilder; |
| | | import springfox.documentation.service.Parameter; |
| | | import springfox.documentation.builders.PathSelectors; |
| | | import springfox.documentation.oas.annotations.EnableOpenApi; |
| | | import springfox.documentation.schema.ModelRef; |
| | | import springfox.documentation.service.ApiInfo; |
| | | 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; |
| | | |
| | | /** |
| | |
| | | .version(version) |
| | | .build(); |
| | | } |
| | | |
| | | @Bean |
| | | public Docket getDocket() { |
| | | public Docket getDocket3() { |
| | | return new Docket(DocumentationType.SWAGGER_2) |
| | | .apiInfo(this.getApiInfo()).groupName("ã管ç端æ¥å£APIã") |
| | | .apiInfo(this.getApiInfo()).groupName("ãå°ç¨åºæ¥å£APIã") |
| | | .host(host) |
| | | .select() |
| | | .apis( basePackage("com.doumee.api.system;com.doumee.api.business;")) |
| | | .apis( basePackage("com.doumee.api.web")) |
| | | // 设置éè¦è¢«æ«æçç±»ï¼è¿é设置为添å äº@Api注解çç±» |
| | | // .apis(RequestHandlerSelectors.withClassAnnotation(Api.class)) |
| | | .paths(PathSelectors.any()) |
| | | .build(); |
| | | .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; |
| | | } |
| | | |
| | | @Bean |
| | | public Docket getDocket2() { |
| | | public Docket getDocket1() { |
| | | return new Docket(DocumentationType.SWAGGER_2) |
| | | .apiInfo(this.getApiInfo()).groupName("ãå
Œ
±æ¥å£APIã") |
| | | .host(host) |
| | | .select() |
| | | .apis( basePackage("com.doumee.api.common")) |
| | | // 设置éè¦è¢«æ«æçç±»ï¼è¿é设置为添å äº@Api注解çç±» |
| | | .apiInfo(this.getApiInfo()).groupName("ãå
Œ
±æ¥å£APIã") |
| | | .host(host) |
| | | .select() |
| | | .apis( basePackage("com.doumee.api.common")) |
| | | // 设置éè¦è¢«æ«æçç±»ï¼è¿é设置为添å äº@Api注解çç±» |
| | | // .apis(RequestHandlerSelectors.withClassAnnotation(Api.class)) |
| | | .paths(PathSelectors.any()) |
| | | .build(); |
| | | .paths(PathSelectors.any()) |
| | | .build(); |
| | | } |
| | | /** |
| | | * éåbasePackageæ¹æ³ï¼ä½¿è½å¤å®ç°å¤å
访é®ï¼å¤å¶è´´ä¸å» |