diff --git a/pom.xml b/pom.xml index 0154633..fc2f97e 100644 --- a/pom.xml +++ b/pom.xml @@ -17,17 +17,17 @@ UTF-8 UTF-8 1.8 - 2.5.8 - 2020.0.4 + 2.6.2 + 2021.0.0 2021.1 2.0.3 - 2.5.4 + 2.6.0 2.2.0 3.0.0 1.6.2 1.27.2 2.3.2 - 1.4.0 + 1.4.1 1.2.8 3.5.0 2.11.0 @@ -37,7 +37,6 @@ 0.9.1 8.2.2 4.1.2 - 2.10.0 3.2.2 2.12.2 2.17.1 @@ -184,13 +183,6 @@ ${transmittable-thread-local.version} - - - org.apache.commons - commons-pool2 - ${common-pool.version} - - org.apache.logging.log4j diff --git a/ruoyi-common/ruoyi-common-core/pom.xml b/ruoyi-common/ruoyi-common-core/pom.xml index 4424f15..57bb257 100644 --- a/ruoyi-common/ruoyi-common-core/pom.xml +++ b/ruoyi-common/ruoyi-common-core/pom.xml @@ -47,12 +47,6 @@ transmittable-thread-local - - - org.apache.commons - commons-pool2 - - com.github.pagehelper diff --git a/ruoyi-common/ruoyi-common-datasource/src/main/java/com/ruoyi/common/datasource/env/ApplicationSeataInitializer.java b/ruoyi-common/ruoyi-common-datasource/src/main/java/com/ruoyi/common/datasource/env/ApplicationSeataInitializer.java new file mode 100644 index 0000000..28394ea --- /dev/null +++ b/ruoyi-common/ruoyi-common-datasource/src/main/java/com/ruoyi/common/datasource/env/ApplicationSeataInitializer.java @@ -0,0 +1,26 @@ +package com.ruoyi.common.datasource.env; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.env.EnvironmentPostProcessor; +import org.springframework.core.Ordered; +import org.springframework.core.env.ConfigurableEnvironment; + +/** + * seata 在 springboot 2.6.x 存在循环引用问题的处理 + * + * @author ruoyi + */ +public class ApplicationSeataInitializer implements EnvironmentPostProcessor, Ordered +{ + @Override + public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) + { + System.setProperty("spring.main.allow-circular-references", "true"); + } + + @Override + public int getOrder() + { + return Ordered.LOWEST_PRECEDENCE; + } +} diff --git a/ruoyi-common/ruoyi-common-datasource/src/main/resources/META-INF/spring.factories b/ruoyi-common/ruoyi-common-datasource/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000..bdfc1f6 --- /dev/null +++ b/ruoyi-common/ruoyi-common-datasource/src/main/resources/META-INF/spring.factories @@ -0,0 +1,2 @@ +org.springframework.boot.env.EnvironmentPostProcessor=\ + com.ruoyi.common.datasource.env.ApplicationSeataInitializer diff --git a/ruoyi-common/ruoyi-common-swagger/src/main/java/com/ruoyi/common/swagger/config/SwaggerBeanPostProcessor.java b/ruoyi-common/ruoyi-common-swagger/src/main/java/com/ruoyi/common/swagger/config/SwaggerBeanPostProcessor.java new file mode 100644 index 0000000..8498f65 --- /dev/null +++ b/ruoyi-common/ruoyi-common-swagger/src/main/java/com/ruoyi/common/swagger/config/SwaggerBeanPostProcessor.java @@ -0,0 +1,54 @@ +package com.ruoyi.common.swagger.config; + +import org.springframework.beans.BeansException; +import org.springframework.beans.factory.config.BeanPostProcessor; +import org.springframework.stereotype.Component; +import org.springframework.util.ReflectionUtils; +import org.springframework.web.servlet.mvc.method.RequestMappingInfoHandlerMapping; +import springfox.documentation.spring.web.plugins.WebFluxRequestHandlerProvider; +import springfox.documentation.spring.web.plugins.WebMvcRequestHandlerProvider; +import java.lang.reflect.Field; +import java.util.List; +import java.util.stream.Collectors; + +/** + * swagger 在 springboot 2.6.x 不兼容问题的处理 + * + * @author ruoyi + */ +@Component +public class SwaggerBeanPostProcessor implements BeanPostProcessor +{ + @Override + public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException + { + if (bean instanceof WebMvcRequestHandlerProvider || bean instanceof WebFluxRequestHandlerProvider) + { + customizeSpringfoxHandlerMappings(getHandlerMappings(bean)); + } + return bean; + } + + private void customizeSpringfoxHandlerMappings(List mappings) + { + List copy = mappings.stream().filter(mapping -> mapping.getPatternParser() == null) + .collect(Collectors.toList()); + mappings.clear(); + mappings.addAll(copy); + } + + @SuppressWarnings("unchecked") + private List getHandlerMappings(Object bean) + { + try + { + Field field = ReflectionUtils.findField(bean.getClass(), "handlerMappings"); + field.setAccessible(true); + return (List) field.get(bean); + } + catch (IllegalArgumentException | IllegalAccessException e) + { + throw new IllegalStateException(e); + } + } +} diff --git a/ruoyi-common/ruoyi-common-swagger/src/main/resources/META-INF/spring.factories b/ruoyi-common/ruoyi-common-swagger/src/main/resources/META-INF/spring.factories index d72ee80..9eab23d 100644 --- a/ruoyi-common/ruoyi-common-swagger/src/main/resources/META-INF/spring.factories +++ b/ruoyi-common/ruoyi-common-swagger/src/main/resources/META-INF/spring.factories @@ -1,3 +1,4 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ com.ruoyi.common.swagger.config.SwaggerAutoConfiguration,\ - com.ruoyi.common.swagger.config.SwaggerWebConfiguration \ No newline at end of file + com.ruoyi.common.swagger.config.SwaggerWebConfiguration,\ + com.ruoyi.common.swagger.config.SwaggerBeanPostProcessor \ No newline at end of file diff --git a/ruoyi-gateway/src/main/resources/bootstrap.yml b/ruoyi-gateway/src/main/resources/bootstrap.yml index 0aa81c2..51502b5 100644 --- a/ruoyi-gateway/src/main/resources/bootstrap.yml +++ b/ruoyi-gateway/src/main/resources/bootstrap.yml @@ -11,6 +11,7 @@ spring: # 环境配置 active: dev main: + allow-circular-references: true allow-bean-definition-overriding: true cloud: nacos: diff --git a/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/util/ScheduleUtils.java b/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/util/ScheduleUtils.java index 1ffd12d..4e8961a 100644 --- a/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/util/ScheduleUtils.java +++ b/ruoyi-modules/ruoyi-job/src/main/java/com/ruoyi/job/util/ScheduleUtils.java @@ -121,7 +121,7 @@ public class ScheduleUtils */ public static boolean whiteList(String invokeTarget) { - String packageName = StringUtils.substringBefore(invokeTarget, ")"); + String packageName = StringUtils.substringBefore(invokeTarget, "("); int count = StringUtils.countMatches(packageName, "."); if (count > 1) { diff --git a/sql/ry_config_20211118.sql b/sql/ry_config_20220110.sql similarity index 95% rename from sql/ry_config_20211118.sql rename to sql/ry_config_20220110.sql index 6fa0d9d..c7d6301 100644 --- a/sql/ry_config_20211118.sql +++ b/sql/ry_config_20220110.sql @@ -32,7 +32,7 @@ CREATE TABLE `config_info` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='config_info'; insert into config_info(id, data_id, group_id, content, md5, gmt_create, gmt_modified, src_user, src_ip, app_name, tenant_id, c_desc, c_use, effect, type, c_schema) values -(1,'application-dev.yml','DEFAULT_GROUP','spring:\n main:\n allow-bean-definition-overriding: true\n autoconfigure:\n exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure\n\n# feign 配置\nfeign:\n sentinel:\n enabled: true\n okhttp:\n enabled: true\n httpclient:\n enabled: false\n client:\n config:\n default:\n connectTimeout: 10000\n readTimeout: 10000\n compression:\n request:\n enabled: true\n response:\n enabled: true\n\n# 暴露监控端点\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\'\n','760986157e62a0c1e0dadf9d2a6acf40','2019-11-29 16:31:20','2021-11-16 12:03:58','','0:0:0:0:0:0:0:1','','','通用配置','null','null','yaml','null'), +(1,'application-dev.yml','DEFAULT_GROUP','spring:\n main:\n allow-circular-references: true\n allow-bean-definition-overriding: true\n autoconfigure:\n exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure\n cloud:\n sentinel:\n filter:\n # sentinel 在 springboot 2.6.x 不兼容问题的处理\n enabled: false\n\n# feign 配置\nfeign:\n sentinel:\n enabled: true\n okhttp:\n enabled: true\n httpclient:\n enabled: false\n client:\n config:\n default:\n connectTimeout: 10000\n readTimeout: 10000\n compression:\n request:\n enabled: true\n response:\n enabled: true\n\n# 暴露监控端点\nmanagement:\n endpoints:\n web:\n exposure:\n include: \'*\'\n','2c34ea2fd8e5393644f25e52a308e57c','2020-05-20 12:00:00','2022-01-10 06:38:19',NULL,'0:0:0:0:0:0:0:1','','','通用配置','null','null','yaml','null'), (2,'ruoyi-gateway-dev.yml','DEFAULT_GROUP','spring:\n redis:\n host: localhost\n port: 6379\n password: \n cloud:\n gateway:\n discovery:\n locator:\n lowerCaseServiceId: true\n enabled: true\n routes:\n # 认证中心\n - id: ruoyi-auth\n uri: lb://ruoyi-auth\n predicates:\n - Path=/auth/**\n filters:\n # 验证码处理\n - CacheRequestFilter\n - ValidateCodeFilter\n - StripPrefix=1\n # 代码生成\n - id: ruoyi-gen\n uri: lb://ruoyi-gen\n predicates:\n - Path=/code/**\n filters:\n - StripPrefix=1\n # 定时任务\n - id: ruoyi-job\n uri: lb://ruoyi-job\n predicates:\n - Path=/schedule/**\n filters:\n - StripPrefix=1\n # 系统模块\n - id: ruoyi-system\n uri: lb://ruoyi-system\n predicates:\n - Path=/system/**\n filters:\n - StripPrefix=1\n # 文件服务\n - id: ruoyi-file\n uri: lb://ruoyi-file\n predicates:\n - Path=/file/**\n filters:\n - StripPrefix=1\n\n# 安全配置\nsecurity:\n # 验证码\n captcha:\n enabled: true\n type: math\n # 防止XSS攻击\n xss:\n enabled: true\n excludeUrls:\n - /system/notice\n # 不校验白名单\n ignore:\n whites:\n - /auth/logout\n - /auth/login\n - /auth/register\n - /*/v2/api-docs\n - /csrf\n','2f5a6b5a4ccf20b5801c5cf842456ec6','2020-05-14 14:17:55','2021-07-30 09:07:14',NULL,'0:0:0:0:0:0:0:1','','','网关模块','null','null','yaml','null'), (3,'ruoyi-auth-dev.yml','DEFAULT_GROUP','spring: \r\n redis:\r\n host: localhost\r\n port: 6379\r\n password: \r\n','b7354e1eb62c2d846d44a796d9ec6930','2020-11-20 00:00:00','2021-02-28 21:06:58',NULL,'0:0:0:0:0:0:0:1','','','认证中心','null','null','yaml','null'), (4,'ruoyi-monitor-dev.yml','DEFAULT_GROUP','# spring\r\nspring: \r\n security:\r\n user:\r\n name: ruoyi\r\n password: 123456\r\n boot:\r\n admin:\r\n ui:\r\n title: 若依服务状态监控\r\n','d8997d0707a2fd5d9fc4e8409da38129','2020-11-20 00:00:00','2020-12-21 16:28:07',NULL,'0:0:0:0:0:0:0:1','','','监控中心','null','null','yaml','null'),