1 files added
1 files renamed
5 files modified
| | |
| | | <alibaba.nacos.version>2.0.1</alibaba.nacos.version>
|
| | | <spring-boot-admin.version>2.4.1</spring-boot-admin.version>
|
| | | <spring-boot.mybatis>2.1.4</spring-boot.mybatis>
|
| | | <swagger.fox.version>2.9.2</swagger.fox.version>
|
| | | <swagger.core.version>1.5.24</swagger.core.version>
|
| | | <swagger.fox.version>3.0.0</swagger.fox.version>
|
| | | <swagger.core.version>1.6.2</swagger.core.version>
|
| | | <tobato.version>1.26.5</tobato.version>
|
| | | <kaptcha.version>2.3.2</kaptcha.version>
|
| | | <pagehelper.boot.version>1.3.0</pagehelper.boot.version>
|
| | |
| | | import java.util.ArrayList;
|
| | | import java.util.Arrays;
|
| | | import java.util.List;
|
| | | import java.util.function.Predicate;
|
| | | import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
| | | import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
| | | import org.springframework.context.annotation.Bean;
|
| | | import org.springframework.context.annotation.Configuration;
|
| | | import com.google.common.base.Predicate;
|
| | | import com.google.common.base.Predicates;
|
| | | import springfox.documentation.builders.ApiInfoBuilder;
|
| | | import springfox.documentation.builders.PathSelectors;
|
| | | import springfox.documentation.builders.RequestHandlerSelectors;
|
| | |
| | | import springfox.documentation.service.AuthorizationScope;
|
| | | import springfox.documentation.service.Contact;
|
| | | import springfox.documentation.service.SecurityReference;
|
| | | import springfox.documentation.service.SecurityScheme;
|
| | | import springfox.documentation.spi.DocumentationType;
|
| | | import springfox.documentation.spi.service.contexts.SecurityContext;
|
| | | import springfox.documentation.spring.web.plugins.ApiSelectorBuilder;
|
| | | import springfox.documentation.spring.web.plugins.Docket;
|
| | | import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
| | |
|
| | |
| | | {
|
| | | swaggerProperties.getExcludePath().addAll(DEFAULT_EXCLUDE_PATH);
|
| | | }
|
| | |
|
| | | List<Predicate<String>> excludePath = new ArrayList<>();
|
| | | swaggerProperties.getExcludePath().forEach(path -> excludePath.add(PathSelectors.ant(path)));
|
| | |
|
| | | //noinspection Guava
|
| | | return new Docket(DocumentationType.SWAGGER_2)
|
| | | .host(swaggerProperties.getHost())
|
| | | ApiSelectorBuilder builder = new Docket(DocumentationType.SWAGGER_2).host(swaggerProperties.getHost())
|
| | | .apiInfo(apiInfo(swaggerProperties)).select()
|
| | | .apis(RequestHandlerSelectors.basePackage(swaggerProperties.getBasePackage()))
|
| | | .paths(Predicates.and(Predicates.not(Predicates.or(excludePath)), Predicates.or(basePath)))
|
| | | .build()
|
| | | .securitySchemes(securitySchemes())
|
| | | .securityContexts(securityContexts())
|
| | | .pathMapping("/");
|
| | | .apis(RequestHandlerSelectors.basePackage(swaggerProperties.getBasePackage()));
|
| | |
|
| | | swaggerProperties.getBasePath().forEach(p -> builder.paths(PathSelectors.ant(p)));
|
| | | swaggerProperties.getExcludePath().forEach(p -> builder.paths(PathSelectors.ant(p).negate()));
|
| | |
|
| | | return builder.build().securitySchemes(securitySchemes()).securityContexts(securityContexts()).pathMapping("/");
|
| | | }
|
| | |
|
| | | /**
|
| | | * 安全模式,这里指定token通过Authorization头请求头传递
|
| | | */
|
| | | private List<ApiKey> securitySchemes()
|
| | | private List<SecurityScheme> securitySchemes()
|
| | | {
|
| | | List<ApiKey> apiKeyList = new ArrayList<ApiKey>();
|
| | | List<SecurityScheme> apiKeyList = new ArrayList<SecurityScheme>();
|
| | | apiKeyList.add(new ApiKey("Authorization", "Authorization", "header"));
|
| | | return apiKeyList;
|
| | | }
|
| | |
| | | securityContexts.add(
|
| | | SecurityContext.builder()
|
| | | .securityReferences(defaultAuth())
|
| | | .forPaths(PathSelectors.regex("^(?!auth).*$"))
|
| | | .operationSelector(o -> o.requestMappingPattern().matches("/.*"))
|
| | | .build());
|
| | | return securityContexts;
|
| | | }
|
| New file |
| | |
| | | package com.ruoyi.common.swagger.config; |
| | | |
| | | import org.springframework.context.annotation.Configuration; |
| | | import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; |
| | | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
| | | |
| | | /** |
| | | * swagger 资源映射路径 |
| | | * |
| | | * @author ruoyi |
| | | */ |
| | | @Configuration |
| | | public class SwaggerWebConfiguration implements WebMvcConfigurer |
| | | { |
| | | @Override |
| | | public void addResourceHandlers(ResourceHandlerRegistry registry) |
| | | { |
| | | /** swagger-ui 地址 */ |
| | | registry.addResourceHandler("/swagger-ui/**") |
| | | .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/"); |
| | | } |
| | | } |
| | |
| | | org.springframework.boot.autoconfigure.EnableAutoConfiguration=\
|
| | | com.ruoyi.common.swagger.config.SwaggerAutoConfiguration
|
| | | com.ruoyi.common.swagger.config.SwaggerAutoConfiguration,\
|
| | | com.ruoyi.common.swagger.config.SwaggerWebConfiguration |
| | |
| | | import org.springframework.cloud.gateway.route.RouteLocator;
|
| | | import org.springframework.cloud.gateway.support.NameUtils;
|
| | | import org.springframework.stereotype.Component;
|
| | | import org.springframework.web.reactive.config.ResourceHandlerRegistry;
|
| | | import org.springframework.web.reactive.config.WebFluxConfigurer;
|
| | | import springfox.documentation.swagger.web.SwaggerResource;
|
| | | import springfox.documentation.swagger.web.SwaggerResourcesProvider;
|
| | |
|
| | |
| | | * @author ruoyi
|
| | | */
|
| | | @Component
|
| | | public class SwaggerProvider implements SwaggerResourcesProvider
|
| | | public class SwaggerProvider implements SwaggerResourcesProvider, WebFluxConfigurer
|
| | | {
|
| | | /**
|
| | | * Swagger2默认的url后缀
|
| | |
| | | swaggerResource.setSwaggerVersion("2.0");
|
| | | return swaggerResource;
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void addResourceHandlers(ResourceHandlerRegistry registry)
|
| | | {
|
| | | /** swagger-ui 地址 */
|
| | | registry.addResourceHandler("/swagger-ui/**")
|
| | | .addResourceLocations("classpath:/META-INF/resources/webjars/springfox-swagger-ui/");
|
| | | }
|
| | | }
|
| File was renamed from sql/ry_20210210.sql |
| | |
| | | insert into sys_menu values('113', 'Admin控制台', '2', '5', 'http://localhost:9100/login', '', 1, 0, 'C', '0', '0', 'monitor:server:list', 'server', 'admin', sysdate(), '', null, '服务监控菜单'); |
| | | insert into sys_menu values('114', '表单构建', '3', '1', 'build', 'tool/build/index', 1, 0, 'C', '0', '0', 'tool:build:list', 'build', 'admin', sysdate(), '', null, '表单构建菜单'); |
| | | insert into sys_menu values('115', '代码生成', '3', '2', 'gen', 'tool/gen/index', 1, 0, 'C', '0', '0', 'tool:gen:list', 'code', 'admin', sysdate(), '', null, '代码生成菜单'); |
| | | insert into sys_menu values('116', '系统接口', '3', '3', 'http://localhost:8080/swagger-ui.html', '', 1, 0, 'C', '0', '0', 'tool:swagger:list', 'swagger', 'admin', sysdate(), '', null, '系统接口菜单'); |
| | | insert into sys_menu values('116', '系统接口', '3', '3', 'http://localhost:8080/swagger-ui/index.html', '', 1, 0, 'C', '0', '0', 'tool:swagger:list', 'swagger', 'admin', sysdate(), '', null, '系统接口菜单'); |
| | | -- 三级菜单 |
| | | insert into sys_menu values('500', '操作日志', '108', '1', 'operlog', 'system/operlog/index', 1, 0, 'C', '0', '0', 'system:operlog:list', 'form', 'admin', sysdate(), '', null, '操作日志菜单'); |
| | | insert into sys_menu values('501', '登录日志', '108', '2', 'logininfor', 'system/logininfor/index', 1, 0, 'C', '0', '0', 'system:logininfor:list', 'logininfor', 'admin', sysdate(), '', null, '登录日志菜单'); |