|
@@ -1,59 +0,0 @@
|
|
|
-package org.jeecg.config;
|
|
|
-
|
|
|
-import io.swagger.v3.oas.annotations.Operation;
|
|
|
-import io.swagger.v3.oas.models.Components;
|
|
|
-import io.swagger.v3.oas.models.OpenAPI;
|
|
|
-import io.swagger.v3.oas.models.Paths;
|
|
|
-import io.swagger.v3.oas.models.info.Contact;
|
|
|
-import io.swagger.v3.oas.models.info.Info;
|
|
|
-import io.swagger.v3.oas.models.info.License;
|
|
|
-import io.swagger.v3.oas.models.security.SecurityRequirement;
|
|
|
-import io.swagger.v3.oas.models.security.SecurityScheme;
|
|
|
-import org.jeecg.common.constant.CommonConstant;
|
|
|
-import org.springdoc.core.models.GroupedOpenApi;
|
|
|
-import org.springframework.context.annotation.Bean;
|
|
|
-import org.springframework.context.annotation.Configuration;
|
|
|
-import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
|
|
|
-import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
|
|
|
-
|
|
|
-@Configuration
|
|
|
-public class Swagger3Config implements WebMvcConfigurer {
|
|
|
- /**
|
|
|
- *
|
|
|
- * 显示swagger-ui.html文档展示页,还必须注入swagger资源:
|
|
|
- *
|
|
|
- * @param registry
|
|
|
- */
|
|
|
- @Override
|
|
|
- public void addResourceHandlers(ResourceHandlerRegistry registry) {
|
|
|
- registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/");
|
|
|
- registry.addResourceHandler("doc.html").addResourceLocations("classpath:/META-INF/resources/");
|
|
|
- registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/");
|
|
|
- }
|
|
|
-
|
|
|
- @Bean
|
|
|
- public GroupedOpenApi swaggerOpenApi() {
|
|
|
- return GroupedOpenApi.builder()
|
|
|
- .group("default")
|
|
|
- .packagesToScan("org.jeecg")
|
|
|
- // 剔除以下几个包路径的接口生成文档
|
|
|
- .packagesToExclude("org.jeecg.modules.drag", "org.jeecg.modules.online", "org.jeecg.modules.jmreport")
|
|
|
- // 加了Operation注解的方法,才生成接口文档
|
|
|
- .addOpenApiMethodFilter(method -> method.isAnnotationPresent(Operation.class))
|
|
|
- .build();
|
|
|
- }
|
|
|
-
|
|
|
- @Bean
|
|
|
- public OpenAPI customOpenAPI() {
|
|
|
- return new OpenAPI()
|
|
|
- .info(new Info()
|
|
|
- .title("JeecgBoot 后台服务API接口文档")
|
|
|
- .version("1.0")
|
|
|
- .contact(new Contact().name("北京国炬信息技术有限公司").url("www.jeccg.com").email("jeecgos@163.com"))
|
|
|
- .description( "后台API接口")
|
|
|
- .termsOfService("NO terms of service")
|
|
|
- .license(new License().name("Apache 2.0").url("http://www.apache.org/licenses/LICENSE-2.0.html"))
|
|
|
- );
|
|
|
- }
|
|
|
-
|
|
|
-}
|