Commit 7d5007045140ed3ff77663c2ef51c03809e27ac1

Authored by 谭毅彬
1 parent 00d29e42

暂时注释Swagger3

Signed-off-by: TanYibin <5491541@qq.com>
huaheng-wms-core/src/main/java/org/jeecg/utils/Swagger3Config.java
... ... @@ -34,70 +34,70 @@ import springfox.documentation.spring.web.plugins.Docket;
34 34 //@Import(BeanValidatorPluginsConfiguration.class)
35 35 public class Swagger3Config implements WebMvcConfigurer {
36 36  
37   - /**
38   - * 显示swagger-ui.html文档展示页,还必须注入swagger资源:
39   - * @param registry
40   - */
41   - @Override
42   - public void addResourceHandlers(ResourceHandlerRegistry registry) {
43   - registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
44   - registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
45   - registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
46   - }
47   -
48   - /**
49   - * swagger2的配置文件,这里可以配置swagger2的一些基本的内容,比如扫描的包等等
50   - * @return Docket
51   - */
52   - @Bean(value = "defaultApi2")
53   - public Docket defaultApi2() {
54   - return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select()
55   - // 此包路径下的类,才生成接口文档
56   - .apis(RequestHandlerSelectors.basePackage("org.jeecg.modules.wms.api"))
57   - // 加了ApiOperation注解的类,才生成接口文档
58   - .apis(RequestHandlerSelectors.withClassAnnotation(RestController.class)).apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
59   - .paths(PathSelectors.any()).build().securitySchemes(Collections.singletonList(securityScheme())).securityContexts(securityContexts());
60   - // .globalOperationParameters(setHeaderToken());
61   - }
62   -
63   - /***
64   - * oauth2配置
65   - * 需要增加swagger授权回调地址
66   - * http://localhost:8888/webjars/springfox-swagger-ui/o2c.html
67   - * @return
68   - */
69   - @Bean
70   - SecurityScheme securityScheme() {
71   - return new ApiKey(CommonConstant.X_ACCESS_TOKEN, CommonConstant.X_ACCESS_TOKEN, "header");
72   - }
73   -
74   - /**
75   - * 新增 securityContexts 保持登录状态
76   - */
77   - private List<SecurityContext> securityContexts() {
78   - return Collections.singletonList(SecurityContext.builder().securityReferences(defaultAuth()).forPaths(PathSelectors.regex("^(?!auth).*$")).build());
79   - }
80   -
81   - /**
82   - * api文档的详细信息函数,注意这里的注解引用的是哪个
83   - * @return
84   - */
85   - private ApiInfo apiInfo() {
86   - return new ApiInfoBuilder()
87   - // //大标题
88   - .title("华恒仓储管理系统API接口文档")
89   - // 版本号
90   - .version("1.0")
91   -// .termsOfServiceUrl("NO terms of service")
92   - // 描述
93   - .description("后台API接口").license("The Apache License, Version 2.0").licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html").build();
94   - }
95   -
96   - private List<SecurityReference> defaultAuth() {
97   - AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
98   - AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
99   - authorizationScopes[0] = authorizationScope;
100   - return Collections.singletonList(new SecurityReference(CommonConstant.X_ACCESS_TOKEN, authorizationScopes));
101   - }
  37 +// /**
  38 +// * 显示swagger-ui.html文档展示页,还必须注入swagger资源:
  39 +// * @param registry
  40 +// */
  41 +// @Override
  42 +// public void addResourceHandlers(ResourceHandlerRegistry registry) {
  43 +// registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
  44 +// registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
  45 +// registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
  46 +// }
  47 +//
  48 +// /**
  49 +// * swagger2的配置文件,这里可以配置swagger2的一些基本的内容,比如扫描的包等等
  50 +// * @return Docket
  51 +// */
  52 +// @Bean(value = "defaultApi2")
  53 +// public Docket defaultApi2() {
  54 +// return new Docket(DocumentationType.SWAGGER_2).apiInfo(apiInfo()).select()
  55 +// // 此包路径下的类,才生成接口文档
  56 +// .apis(RequestHandlerSelectors.basePackage("org.jeecg.modules.wms.api"))
  57 +// // 加了ApiOperation注解的类,才生成接口文档
  58 +// .apis(RequestHandlerSelectors.withClassAnnotation(RestController.class)).apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
  59 +// .paths(PathSelectors.any()).build().securitySchemes(Collections.singletonList(securityScheme())).securityContexts(securityContexts());
  60 +// // .globalOperationParameters(setHeaderToken());
  61 +// }
  62 +//
  63 +// /***
  64 +// * oauth2配置
  65 +// * 需要增加swagger授权回调地址
  66 +// * http://localhost:8888/webjars/springfox-swagger-ui/o2c.html
  67 +// * @return
  68 +// */
  69 +// @Bean
  70 +// SecurityScheme securityScheme() {
  71 +// return new ApiKey(CommonConstant.X_ACCESS_TOKEN, CommonConstant.X_ACCESS_TOKEN, "header");
  72 +// }
  73 +//
  74 +// /**
  75 +// * 新增 securityContexts 保持登录状态
  76 +// */
  77 +// private List<SecurityContext> securityContexts() {
  78 +// return Collections.singletonList(SecurityContext.builder().securityReferences(defaultAuth()).forPaths(PathSelectors.regex("^(?!auth).*$")).build());
  79 +// }
  80 +//
  81 +// /**
  82 +// * api文档的详细信息函数,注意这里的注解引用的是哪个
  83 +// * @return
  84 +// */
  85 +// private ApiInfo apiInfo() {
  86 +// return new ApiInfoBuilder()
  87 +// // //大标题
  88 +// .title("华恒仓储管理系统API接口文档")
  89 +// // 版本号
  90 +// .version("1.0")
  91 +//// .termsOfServiceUrl("NO terms of service")
  92 +// // 描述
  93 +// .description("后台API接口").license("The Apache License, Version 2.0").licenseUrl("http://www.apache.org/licenses/LICENSE-2.0.html").build();
  94 +// }
  95 +//
  96 +// private List<SecurityReference> defaultAuth() {
  97 +// AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything");
  98 +// AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
  99 +// authorizationScopes[0] = authorizationScope;
  100 +// return Collections.singletonList(new SecurityReference(CommonConstant.X_ACCESS_TOKEN, authorizationScopes));
  101 +// }
102 102  
103 103 }
... ...