From a0d0c91a78253e8c1b9acd3e17bbd41c2acc0f29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Wed, 27 Mar 2024 07:19:48 +0000 Subject: [PATCH] =?UTF-8?q?!58=20update=20=E4=BC=98=E5=8C=96=20=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E5=88=A4=E6=96=AD=E6=95=B0=E6=8D=AE=E5=BA=93=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=20*=20fix=20=E4=BF=AE=E5=A4=8D=20=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E8=A3=85=E9=85=8D=E6=97=A0=E6=B3=95=E8=8E=B7=E5=8F=96spring?= =?UTF-8?q?=E4=B8=8A=E4=B8=8B=E9=97=AE=E9=A2=98=E9=97=AE=E9=A2=98=20*=20re?= =?UTF-8?q?move=20=E5=88=A0=E9=99=A4=E6=97=A0=E7=94=A8=E5=AF=BC=E5=8C=85?= =?UTF-8?q?=E5=92=8Cbean=E6=B3=A8=E5=85=A5=20*=20update=20=E4=BC=98?= =?UTF-8?q?=E5=8C=96=20=E8=87=AA=E5=8A=A8=E5=88=A4=E6=96=AD=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=BA=93=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/core/context/SpringContext.java | 36 +++++++++++++++---- .../easy/retry/common/core/log/LogUtils.java | 2 +- .../access/config/AbstractConfigAccess.java | 6 ++-- .../access/task/AbstractTaskAccess.java | 7 ++-- .../EasyRetryTemplateAutoConfiguration.java | 7 ++-- .../template/datasource/enums/DbTypeEnum.java | 4 +-- .../template/datasource/utils/DbUtils.java | 21 +++++++++++ .../EasyRetryMariadbAutoConfiguration.java | 16 --------- ...ot.autoconfigure.AutoConfiguration.imports | 1 - .../EasyRetryMysqlAutoConfiguration.java | 16 --------- ...ot.autoconfigure.AutoConfiguration.imports | 1 - .../EasyRetryOracleAutoConfiguration.java | 16 --------- ...ot.autoconfigure.AutoConfiguration.imports | 1 - .../EasyRetryPostgresAutoConfiguration.java | 17 --------- ...ot.autoconfigure.AutoConfiguration.imports | 1 - .../mapper/DistributedLockMapper.xml | 0 .../mapper/GroupConfigMapper.xml | 0 .../mapper/JobLogMessageMapper.xml | 0 .../mapper/JobMapper.xml | 0 .../mapper/JobNotifyConfigMapper.xml | 0 .../mapper/JobSummaryMapper.xml | 0 .../mapper/JobTaskBatchMapper.xml | 0 .../mapper/JobTaskMapper.xml | 0 .../mapper/NotifyConfigMapper.xml | 0 .../mapper/RetryDeadLetterMapper.xml | 0 .../mapper/RetrySummaryMapper.xml | 0 .../mapper/RetryTaskLogMapper.xml | 0 .../mapper/RetryTaskLogMessageMapper.xml | 0 .../mapper/RetryTaskMapper.xml | 0 .../mapper/SceneConfigMapper.xml | 0 .../mapper/SequenceAllocMapper.xml | 0 .../mapper/ServerNodeMapper.xml | 0 .../mapper/SystemUserMapper.xml | 0 .../mapper/SystemUserPermissionMapper.xml | 0 .../mapper/WorkflowMapper.xml | 0 .../mapper/WorkflowNodeMapper.xml | 0 .../mapper/WorkflowTaskBatchMapper.xml | 0 .../EasyRetrySqlServerAutoConfiguration.java | 16 --------- ...ot.autoconfigure.AutoConfiguration.imports | 1 - .../common/client/RpcClientInvokeHandler.java | 4 +-- .../common/config/SystemProperties.java | 3 ++ .../lock/persistence/LockStorageFactory.java | 9 +++-- .../support/dispatch/JobExecutorActor.java | 2 +- .../support/handler/JobTaskBatchHandler.java | 2 +- .../starter/server/RequestHandlerActor.java | 2 +- .../service/impl/DashBoardServiceImpl.java | 7 ++-- 46 files changed, 75 insertions(+), 123 deletions(-) create mode 100644 easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/utils/DbUtils.java delete mode 100644 easy-retry-datasource/easy-retry-mariadb-datasource/src/main/java/com/aizuda/easy/retry/mariadb/datasource/config/EasyRetryMariadbAutoConfiguration.java delete mode 100644 easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports delete mode 100644 easy-retry-datasource/easy-retry-mysql-datasource/src/main/java/com/aizuda/easy/retry/mysql/datasource/config/EasyRetryMysqlAutoConfiguration.java delete mode 100644 easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports delete mode 100644 easy-retry-datasource/easy-retry-oracle-datasource/src/main/java/com/aizuda/easy/retry/oracle/datasource/config/EasyRetryOracleAutoConfiguration.java delete mode 100644 easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports delete mode 100644 easy-retry-datasource/easy-retry-postgres-datasource/src/main/java/com/aizuda/easy/retry/postgres/datasource/config/EasyRetryPostgresAutoConfiguration.java delete mode 100644 easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports rename easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/{postgres => postgresql}/mapper/DistributedLockMapper.xml (100%) rename easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/{postgres => postgresql}/mapper/GroupConfigMapper.xml (100%) rename easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/{postgres => postgresql}/mapper/JobLogMessageMapper.xml (100%) rename easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/{postgres => postgresql}/mapper/JobMapper.xml (100%) rename easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/{postgres => postgresql}/mapper/JobNotifyConfigMapper.xml (100%) rename easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/{postgres => postgresql}/mapper/JobSummaryMapper.xml (100%) rename easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/{postgres => postgresql}/mapper/JobTaskBatchMapper.xml (100%) rename easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/{postgres => postgresql}/mapper/JobTaskMapper.xml (100%) rename easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/{postgres => postgresql}/mapper/NotifyConfigMapper.xml (100%) rename easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/{postgres => postgresql}/mapper/RetryDeadLetterMapper.xml (100%) rename easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/{postgres => postgresql}/mapper/RetrySummaryMapper.xml (100%) rename easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/{postgres => postgresql}/mapper/RetryTaskLogMapper.xml (100%) rename easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/{postgres => postgresql}/mapper/RetryTaskLogMessageMapper.xml (100%) rename easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/{postgres => postgresql}/mapper/RetryTaskMapper.xml (100%) rename easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/{postgres => postgresql}/mapper/SceneConfigMapper.xml (100%) rename easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/{postgres => postgresql}/mapper/SequenceAllocMapper.xml (100%) rename easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/{postgres => postgresql}/mapper/ServerNodeMapper.xml (100%) rename easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/{postgres => postgresql}/mapper/SystemUserMapper.xml (100%) rename easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/{postgres => postgresql}/mapper/SystemUserPermissionMapper.xml (100%) rename easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/{postgres => postgresql}/mapper/WorkflowMapper.xml (100%) rename easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/{postgres => postgresql}/mapper/WorkflowNodeMapper.xml (100%) rename easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/{postgres => postgresql}/mapper/WorkflowTaskBatchMapper.xml (100%) delete mode 100644 easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/java/com/aizuda/easy/retry/sqlserver/datasource/config/EasyRetrySqlServerAutoConfiguration.java delete mode 100644 easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports diff --git a/easy-retry-common/easy-retry-common-core/src/main/java/com/aizuda/easy/retry/common/core/context/SpringContext.java b/easy-retry-common/easy-retry-common-core/src/main/java/com/aizuda/easy/retry/common/core/context/SpringContext.java index 20ecacf9..5b2eee80 100644 --- a/easy-retry-common/easy-retry-common-core/src/main/java/com/aizuda/easy/retry/common/core/context/SpringContext.java +++ b/easy-retry-common/easy-retry-common-core/src/main/java/com/aizuda/easy/retry/common/core/context/SpringContext.java @@ -2,6 +2,9 @@ package com.aizuda.easy.retry.common.core.context; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.BeansException; +import org.springframework.beans.factory.ListableBeanFactory; +import org.springframework.beans.factory.config.BeanFactoryPostProcessor; +import org.springframework.beans.factory.config.ConfigurableListableBeanFactory; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; import org.springframework.core.Ordered; @@ -15,23 +18,42 @@ import org.springframework.stereotype.Component; @Component @Order(Ordered.HIGHEST_PRECEDENCE) @Slf4j -public class SpringContext implements ApplicationContextAware { +public class SpringContext implements BeanFactoryPostProcessor, ApplicationContextAware { - public static ApplicationContext CONTEXT; + private static ConfigurableListableBeanFactory FACTORY; + + private static ApplicationContext CONTEXT; @Override - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) { + SpringContext.FACTORY = beanFactory; + } + + @Override + public void setApplicationContext(ApplicationContext applicationContext) { SpringContext.CONTEXT = applicationContext; } + public static ListableBeanFactory getBeanFactory() { + final ListableBeanFactory factory = null == FACTORY ? CONTEXT : FACTORY; + if (null == factory) { + throw new RuntimeException("No ConfigurableListableBeanFactory or ApplicationContext injected, maybe not in the Spring environment?"); + } + return factory; + } + + public static ApplicationContext getContext() { + return CONTEXT; + } + public static T getBeanByType(Class clazz) { - return CONTEXT.getBean(clazz); + return getBeanFactory().getBean(clazz); } public static synchronized T getBean(String name) { try { - return (T) CONTEXT.getBean(name); + return (T) getBeanFactory().getBean(name); } catch (BeansException | NullPointerException exception) { log.error(" BeanName:{} not exist,Exception => {}", name, exception.getMessage()); return null; @@ -40,7 +62,7 @@ public class SpringContext implements ApplicationContextAware { public static synchronized T getBean(Class requiredType) { try { - return CONTEXT.getBean(requiredType); + return getBeanFactory().getBean(requiredType); } catch (BeansException | NullPointerException exception) { log.error(" BeanName:{} not exist,Exception => {}", requiredType.getName(), exception.getMessage()); return null; @@ -49,7 +71,7 @@ public class SpringContext implements ApplicationContextAware { public static synchronized T getBean(String name, Class requiredType) { try { - return CONTEXT.getBean(name, requiredType); + return getBeanFactory().getBean(name, requiredType); } catch (BeansException | NullPointerException exception) { log.error(" BeanName:{} not exist,Exception => {}", name, exception.getMessage()); return null; diff --git a/easy-retry-common/easy-retry-common-core/src/main/java/com/aizuda/easy/retry/common/core/log/LogUtils.java b/easy-retry-common/easy-retry-common-core/src/main/java/com/aizuda/easy/retry/common/core/log/LogUtils.java index b7f68778..bbd2f964 100644 --- a/easy-retry-common/easy-retry-common-core/src/main/java/com/aizuda/easy/retry/common/core/log/LogUtils.java +++ b/easy-retry-common/easy-retry-common-core/src/main/java/com/aizuda/easy/retry/common/core/log/LogUtils.java @@ -69,7 +69,7 @@ public class LogUtils { private static Boolean getLogStatus() { try { - Environment environment = SpringContext.CONTEXT.getBean(Environment.class); + Environment environment = SpringContext.getBean(Environment.class); return environment.getProperty("easy-retry.log.status", Boolean.class, Boolean.TRUE); } catch (Exception ignored) { } diff --git a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/access/config/AbstractConfigAccess.java b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/access/config/AbstractConfigAccess.java index 0123ec74..fa2d62f5 100644 --- a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/access/config/AbstractConfigAccess.java +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/access/config/AbstractConfigAccess.java @@ -12,6 +12,7 @@ import com.aizuda.easy.retry.template.datasource.persistence.mapper.SceneConfigM import com.aizuda.easy.retry.template.datasource.persistence.po.GroupConfig; import com.aizuda.easy.retry.template.datasource.persistence.po.NotifyConfig; import com.aizuda.easy.retry.template.datasource.persistence.po.SceneConfig; +import com.aizuda.easy.retry.template.datasource.utils.DbUtils; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.core.env.Environment; @@ -34,8 +35,6 @@ public abstract class AbstractConfigAccess implements ConfigAccess { protected SceneConfigMapper sceneConfigMapper; @Autowired protected GroupConfigMapper groupConfigMapper; - @Autowired - protected Environment environment; protected static final List ALLOW_DB = Arrays.asList( DbTypeEnum.MYSQL.getDb(), @@ -45,8 +44,7 @@ public abstract class AbstractConfigAccess implements ConfigAccess { DbTypeEnum.SQLSERVER.getDb()); protected DbTypeEnum getDbType() { - String dbType = environment.getProperty("easy-retry.db-type"); - return DbTypeEnum.modeOf(dbType); + return DbUtils.getDbType(); } protected List getByGroupIdAndNotifyScene(String groupName, Integer notifyScene, String namespaceId) { diff --git a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/access/task/AbstractTaskAccess.java b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/access/task/AbstractTaskAccess.java index d634f549..59e4c4fa 100644 --- a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/access/task/AbstractTaskAccess.java +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/access/task/AbstractTaskAccess.java @@ -2,6 +2,7 @@ package com.aizuda.easy.retry.template.datasource.access.task; import com.aizuda.easy.retry.template.datasource.access.TaskAccess; import com.aizuda.easy.retry.template.datasource.enums.DbTypeEnum; +import com.aizuda.easy.retry.template.datasource.utils.DbUtils; import com.aizuda.easy.retry.template.datasource.utils.RequestDataHelper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; @@ -18,9 +19,6 @@ import java.util.List; */ public abstract class AbstractTaskAccess implements TaskAccess { - @Autowired - protected Environment environment; - protected static final List ALLOW_DB = Arrays.asList( DbTypeEnum.MYSQL.getDb(), DbTypeEnum.MARIADB.getDb(), @@ -29,8 +27,7 @@ public abstract class AbstractTaskAccess implements TaskAccess { DbTypeEnum.SQLSERVER.getDb()); protected DbTypeEnum getDbType() { - String dbType = environment.getProperty("easy-retry.db-type"); - return DbTypeEnum.modeOf(dbType); + return DbUtils.getDbType(); } /** diff --git a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/config/EasyRetryTemplateAutoConfiguration.java b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/config/EasyRetryTemplateAutoConfiguration.java index f4482dda..5a093be1 100644 --- a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/config/EasyRetryTemplateAutoConfiguration.java +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/config/EasyRetryTemplateAutoConfiguration.java @@ -2,6 +2,7 @@ package com.aizuda.easy.retry.template.datasource.config; import cn.hutool.core.util.StrUtil; import com.aizuda.easy.retry.template.datasource.enums.DbTypeEnum; +import com.aizuda.easy.retry.template.datasource.utils.DbUtils; import com.aizuda.easy.retry.template.datasource.utils.RequestDataHelper; import com.baomidou.mybatisplus.autoconfigure.MybatisPlusProperties; import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; @@ -36,8 +37,7 @@ public class EasyRetryTemplateAutoConfiguration { public SqlSessionFactory sqlSessionFactory(DataSource dataSource, Environment environment, MybatisPlusInterceptor mybatisPlusInterceptor, MybatisPlusProperties mybatisPlusProperties) throws Exception { MybatisSqlSessionFactoryBean factoryBean = new MybatisSqlSessionFactoryBean(); factoryBean.setDataSource(dataSource); - String dbType = environment.getProperty("easy-retry.db-type"); - DbTypeEnum dbTypeEnum = DbTypeEnum.modeOf(dbType); + DbTypeEnum dbTypeEnum = DbUtils.getDbType(); factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources(MessageFormat.format("classpath*:/{0}/mapper/*.xml", dbTypeEnum.getDb()))); factoryBean.setPlugins(mybatisPlusInterceptor); factoryBean.setTypeAliasesPackage(mybatisPlusProperties.getTypeAliasesPackage()); @@ -58,8 +58,7 @@ public class EasyRetryTemplateAutoConfiguration { MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor(); String tablePrefix = Optional.ofNullable(environment.getProperty("mybatis-plus.global-config.db-config.table-prefix")).orElse(StrUtil.EMPTY); interceptor.addInnerInterceptor(dynamicTableNameInnerInterceptor(tablePrefix)); - String dbType = environment.getProperty("easy-retry.db-type"); - DbTypeEnum dbTypeEnum = DbTypeEnum.modeOf(dbType); + DbTypeEnum dbTypeEnum = DbUtils.getDbType(); interceptor.addInnerInterceptor(new PaginationInnerInterceptor(dbTypeEnum.getMpDbType())); return interceptor; diff --git a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/enums/DbTypeEnum.java b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/enums/DbTypeEnum.java index 2051c1fb..491492d8 100644 --- a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/enums/DbTypeEnum.java +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/enums/DbTypeEnum.java @@ -19,7 +19,7 @@ import java.util.Objects; public enum DbTypeEnum { MYSQL("mysql", "MySql数据库", DbType.MYSQL), MARIADB("mariadb", "MariaDB数据库", DbType.MARIADB), - POSTGRES("postgres", "Postgres数据库", DbType.POSTGRE_SQL), + POSTGRES("postgresql", "Postgres数据库", DbType.POSTGRE_SQL), ORACLE("oracle", "Oracle数据库", DbType.ORACLE_12C), SQLSERVER("sqlserver", "SQLServer数据库", DbType.SQL_SERVER); @@ -29,7 +29,7 @@ public enum DbTypeEnum { public static DbTypeEnum modeOf(String db) { for (DbTypeEnum value : DbTypeEnum.values()) { - if (Objects.equals(value.getDb(), db)) { + if (db.contains(value.getDb())) { return value; } } diff --git a/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/utils/DbUtils.java b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/utils/DbUtils.java new file mode 100644 index 00000000..e3adc4fe --- /dev/null +++ b/easy-retry-datasource/easy-retry-datasource-template/src/main/java/com/aizuda/easy/retry/template/datasource/utils/DbUtils.java @@ -0,0 +1,21 @@ +package com.aizuda.easy.retry.template.datasource.utils; + +import com.aizuda.easy.retry.common.core.context.SpringContext; +import com.aizuda.easy.retry.template.datasource.enums.DbTypeEnum; +import org.springframework.core.env.Environment; + +/** + * 数据库工具 + * + * @author: 疯狂的狮子Li + * @date : 2024-03-27 14:17 + */ +public class DbUtils { + + public static DbTypeEnum getDbType() { + Environment environment = SpringContext.getBean(Environment.class); + String url = environment.getProperty("spring.datasource.url"); + return DbTypeEnum.modeOf(url); + } + +} diff --git a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/java/com/aizuda/easy/retry/mariadb/datasource/config/EasyRetryMariadbAutoConfiguration.java b/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/java/com/aizuda/easy/retry/mariadb/datasource/config/EasyRetryMariadbAutoConfiguration.java deleted file mode 100644 index 447f813e..00000000 --- a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/java/com/aizuda/easy/retry/mariadb/datasource/config/EasyRetryMariadbAutoConfiguration.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.aizuda.easy.retry.mariadb.datasource.config; - -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; - -/** - * @author: www.byteblogs.com - * @date : 2023-08-04 12:37 - */ -@Configuration -@ComponentScan("com.aizuda.easy.retry.mariadb.datasource.*") -@ConditionalOnProperty(prefix = "easy-retry", name = "db-type", havingValue = "mariadb") -public class EasyRetryMariadbAutoConfiguration { - -} diff --git a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports deleted file mode 100644 index c1b66054..00000000 --- a/easy-retry-datasource/easy-retry-mariadb-datasource/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ /dev/null @@ -1 +0,0 @@ -com.aizuda.easy.retry.mariadb.datasource.config.EasyRetryMariadbAutoConfiguration diff --git a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/java/com/aizuda/easy/retry/mysql/datasource/config/EasyRetryMysqlAutoConfiguration.java b/easy-retry-datasource/easy-retry-mysql-datasource/src/main/java/com/aizuda/easy/retry/mysql/datasource/config/EasyRetryMysqlAutoConfiguration.java deleted file mode 100644 index e61f663d..00000000 --- a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/java/com/aizuda/easy/retry/mysql/datasource/config/EasyRetryMysqlAutoConfiguration.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.aizuda.easy.retry.mysql.datasource.config; - -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; - -/** - * @author: www.byteblogs.com - * @date : 2023-08-04 12:37 - */ -@Configuration -@ComponentScan("com.aizuda.easy.retry.mysql.datasource") -@ConditionalOnProperty(prefix = "easy-retry", name = "db-type", havingValue = "mysql") -public class EasyRetryMysqlAutoConfiguration { - -} diff --git a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports deleted file mode 100644 index d9c69eb4..00000000 --- a/easy-retry-datasource/easy-retry-mysql-datasource/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ /dev/null @@ -1 +0,0 @@ -com.aizuda.easy.retry.mysql.datasource.config.EasyRetryMysqlAutoConfiguration \ No newline at end of file diff --git a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/java/com/aizuda/easy/retry/oracle/datasource/config/EasyRetryOracleAutoConfiguration.java b/easy-retry-datasource/easy-retry-oracle-datasource/src/main/java/com/aizuda/easy/retry/oracle/datasource/config/EasyRetryOracleAutoConfiguration.java deleted file mode 100644 index ca49d51c..00000000 --- a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/java/com/aizuda/easy/retry/oracle/datasource/config/EasyRetryOracleAutoConfiguration.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.aizuda.easy.retry.oracle.datasource.config; - -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; - -/** - * @author: www.byteblogs.com - * @date : 2023-08-04 12:37 - */ -@Configuration -@ComponentScan("com.aizuda.easy.retry.oracle.datasource.*") -@ConditionalOnProperty(prefix = "easy-retry", name = "db-type", havingValue = "oracle") -public class EasyRetryOracleAutoConfiguration { - -} diff --git a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports deleted file mode 100644 index 4710d152..00000000 --- a/easy-retry-datasource/easy-retry-oracle-datasource/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ /dev/null @@ -1 +0,0 @@ -com.aizuda.easy.retry.oracle.datasource.config.EasyRetryOracleAutoConfiguration \ No newline at end of file diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/java/com/aizuda/easy/retry/postgres/datasource/config/EasyRetryPostgresAutoConfiguration.java b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/java/com/aizuda/easy/retry/postgres/datasource/config/EasyRetryPostgresAutoConfiguration.java deleted file mode 100644 index edcaa534..00000000 --- a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/java/com/aizuda/easy/retry/postgres/datasource/config/EasyRetryPostgresAutoConfiguration.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.aizuda.easy.retry.postgres.datasource.config; - -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.PropertySource; - -/** - * @author: www.byteblogs.com - * @date : 2023-08-04 12:37 - */ -@Configuration -@ComponentScan("com.aizuda.easy.retry.postgres.datasource.*") -@ConditionalOnProperty(prefix = "easy-retry", name = "db-type", havingValue = "postgres") -public class EasyRetryPostgresAutoConfiguration { - -} diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports deleted file mode 100644 index 64befaad..00000000 --- a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ /dev/null @@ -1 +0,0 @@ -com.aizuda.easy.retry.postgres.datasource.config.EasyRetryPostgresAutoConfiguration diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/DistributedLockMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/DistributedLockMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/DistributedLockMapper.xml rename to easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/DistributedLockMapper.xml diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/GroupConfigMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/GroupConfigMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/GroupConfigMapper.xml rename to easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/GroupConfigMapper.xml diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/JobLogMessageMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/JobLogMessageMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/JobLogMessageMapper.xml rename to easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/JobLogMessageMapper.xml diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/JobMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/JobMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/JobMapper.xml rename to easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/JobMapper.xml diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/JobNotifyConfigMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/JobNotifyConfigMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/JobNotifyConfigMapper.xml rename to easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/JobNotifyConfigMapper.xml diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/JobSummaryMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/JobSummaryMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/JobSummaryMapper.xml rename to easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/JobSummaryMapper.xml diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/JobTaskBatchMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/JobTaskBatchMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/JobTaskBatchMapper.xml rename to easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/JobTaskBatchMapper.xml diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/JobTaskMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/JobTaskMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/JobTaskMapper.xml rename to easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/JobTaskMapper.xml diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/NotifyConfigMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/NotifyConfigMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/NotifyConfigMapper.xml rename to easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/NotifyConfigMapper.xml diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/RetryDeadLetterMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/RetryDeadLetterMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/RetryDeadLetterMapper.xml rename to easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/RetryDeadLetterMapper.xml diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/RetrySummaryMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/RetrySummaryMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/RetrySummaryMapper.xml rename to easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/RetrySummaryMapper.xml diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/RetryTaskLogMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/RetryTaskLogMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/RetryTaskLogMapper.xml rename to easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/RetryTaskLogMapper.xml diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/RetryTaskLogMessageMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/RetryTaskLogMessageMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/RetryTaskLogMessageMapper.xml rename to easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/RetryTaskLogMessageMapper.xml diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/RetryTaskMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/RetryTaskMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/RetryTaskMapper.xml rename to easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/RetryTaskMapper.xml diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/SceneConfigMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/SceneConfigMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/SceneConfigMapper.xml rename to easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/SceneConfigMapper.xml diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/SequenceAllocMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/SequenceAllocMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/SequenceAllocMapper.xml rename to easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/SequenceAllocMapper.xml diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/ServerNodeMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/ServerNodeMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/ServerNodeMapper.xml rename to easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/ServerNodeMapper.xml diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/SystemUserMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/SystemUserMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/SystemUserMapper.xml rename to easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/SystemUserMapper.xml diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/SystemUserPermissionMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/SystemUserPermissionMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/SystemUserPermissionMapper.xml rename to easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/SystemUserPermissionMapper.xml diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/WorkflowMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/WorkflowMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/WorkflowMapper.xml rename to easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/WorkflowMapper.xml diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/WorkflowNodeMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/WorkflowNodeMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/WorkflowNodeMapper.xml rename to easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/WorkflowNodeMapper.xml diff --git a/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/WorkflowTaskBatchMapper.xml b/easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/WorkflowTaskBatchMapper.xml similarity index 100% rename from easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgres/mapper/WorkflowTaskBatchMapper.xml rename to easy-retry-datasource/easy-retry-postgres-datasource/src/main/resources/postgresql/mapper/WorkflowTaskBatchMapper.xml diff --git a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/java/com/aizuda/easy/retry/sqlserver/datasource/config/EasyRetrySqlServerAutoConfiguration.java b/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/java/com/aizuda/easy/retry/sqlserver/datasource/config/EasyRetrySqlServerAutoConfiguration.java deleted file mode 100644 index a9c140da..00000000 --- a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/java/com/aizuda/easy/retry/sqlserver/datasource/config/EasyRetrySqlServerAutoConfiguration.java +++ /dev/null @@ -1,16 +0,0 @@ -package com.aizuda.easy.retry.sqlserver.datasource.config; - -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; - -/** - * @author: www.byteblogs.com - * @date : 2024-03-19 22:05 - */ -@Configuration -@ComponentScan("com.aizuda.easy.retry.sqlserver.datasource.*") -@ConditionalOnProperty(prefix = "easy-retry", name = "db-type", havingValue = "sqlserver") -public class EasyRetrySqlServerAutoConfiguration { - -} diff --git a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports deleted file mode 100644 index cb288191..00000000 --- a/easy-retry-datasource/easy-retry-sqlserver-datasource/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports +++ /dev/null @@ -1 +0,0 @@ -com.aizuda.easy.retry.sqlserver.datasource.config.EasyRetrySqlServerAutoConfiguration \ No newline at end of file diff --git a/easy-retry-server/easy-retry-server-common/src/main/java/com/aizuda/easy/retry/server/common/client/RpcClientInvokeHandler.java b/easy-retry-server/easy-retry-server-common/src/main/java/com/aizuda/easy/retry/server/common/client/RpcClientInvokeHandler.java index 409764ff..f4581a8e 100644 --- a/easy-retry-server/easy-retry-server-common/src/main/java/com/aizuda/easy/retry/server/common/client/RpcClientInvokeHandler.java +++ b/easy-retry-server/easy-retry-server-common/src/main/java/com/aizuda/easy/retry/server/common/client/RpcClientInvokeHandler.java @@ -133,7 +133,7 @@ public class RpcClientInvokeHandler implements InvocationHandler { Assert.notNull(parasResult.body, () -> new EasyRetryServerException("body cannot be null")); } - RestTemplate restTemplate = SpringContext.CONTEXT.getBean(RestTemplate.class); + RestTemplate restTemplate = SpringContext.getBean(RestTemplate.class); Retryer retryer = buildResultRetryer(); @@ -169,7 +169,7 @@ public class RpcClientInvokeHandler implements InvocationHandler { // 进行路由剔除处理 CacheRegisterTable.remove(groupName, namespaceId, hostId); // 重新选一个可用的客户端节点 - ClientNodeAllocateHandler clientNodeAllocateHandler = SpringContext.CONTEXT.getBean( + ClientNodeAllocateHandler clientNodeAllocateHandler = SpringContext.getBean( ClientNodeAllocateHandler.class); RegisterNodeInfo serverNode = clientNodeAllocateHandler.getServerNode(allocKey, groupName, namespaceId, routeKey); diff --git a/easy-retry-server/easy-retry-server-common/src/main/java/com/aizuda/easy/retry/server/common/config/SystemProperties.java b/easy-retry-server/easy-retry-server-common/src/main/java/com/aizuda/easy/retry/server/common/config/SystemProperties.java index 6ed680e6..177b0953 100644 --- a/easy-retry-server/easy-retry-server-common/src/main/java/com/aizuda/easy/retry/server/common/config/SystemProperties.java +++ b/easy-retry-server/easy-retry-server-common/src/main/java/com/aizuda/easy/retry/server/common/config/SystemProperties.java @@ -75,7 +75,10 @@ public class SystemProperties { /** * 数据库类型 + * + * @deprecated 废弃 新版本通过数据源url自动判断 */ + @Deprecated private DbTypeEnum dbType = DbTypeEnum.MYSQL; /** diff --git a/easy-retry-server/easy-retry-server-common/src/main/java/com/aizuda/easy/retry/server/common/lock/persistence/LockStorageFactory.java b/easy-retry-server/easy-retry-server-common/src/main/java/com/aizuda/easy/retry/server/common/lock/persistence/LockStorageFactory.java index b9dd0831..1afc5d50 100644 --- a/easy-retry-server/easy-retry-server-common/src/main/java/com/aizuda/easy/retry/server/common/lock/persistence/LockStorageFactory.java +++ b/easy-retry-server/easy-retry-server-common/src/main/java/com/aizuda/easy/retry/server/common/lock/persistence/LockStorageFactory.java @@ -1,9 +1,8 @@ package com.aizuda.easy.retry.server.common.lock.persistence; -import com.aizuda.easy.retry.common.core.context.SpringContext; -import com.aizuda.easy.retry.server.common.config.SystemProperties; import com.aizuda.easy.retry.server.common.exception.EasyRetryServerException; -import com.aizuda.easy.retry.server.common.lock.LockProvider; +import com.aizuda.easy.retry.template.datasource.enums.DbTypeEnum; +import com.aizuda.easy.retry.template.datasource.utils.DbUtils; import com.google.common.collect.Lists; import java.util.List; @@ -22,9 +21,9 @@ public final class LockStorageFactory { } public static LockStorage getLockStorage() { - SystemProperties systemProperties = SpringContext.getBeanByType(SystemProperties.class); + DbTypeEnum db = DbUtils.getDbType(); return LOCK_STORAGES.stream() - .filter(lockProvider -> lockProvider.supports(systemProperties.getDbType().getDb())) + .filter(lockProvider -> lockProvider.supports(db.getDb())) .findFirst().orElseThrow(() -> new EasyRetryServerException("未找到合适锁处理器")); } diff --git a/easy-retry-server/easy-retry-server-job-task/src/main/java/com/aizuda/easy/retry/server/job/task/support/dispatch/JobExecutorActor.java b/easy-retry-server/easy-retry-server-job-task/src/main/java/com/aizuda/easy/retry/server/job/task/support/dispatch/JobExecutorActor.java index d5b08efe..5f59f0ec 100644 --- a/easy-retry-server/easy-retry-server-job-task/src/main/java/com/aizuda/easy/retry/server/job/task/support/dispatch/JobExecutorActor.java +++ b/easy-retry-server/easy-retry-server-job-task/src/main/java/com/aizuda/easy/retry/server/job/task/support/dispatch/JobExecutorActor.java @@ -91,7 +91,7 @@ public class JobExecutorActor extends AbstractActor { } catch (Exception e) { EasyRetryLog.LOCAL.error("job executor exception. [{}]", taskExecute, e); handlerTaskBatch(taskExecute, JobTaskBatchStatusEnum.FAIL.getStatus(), JobOperationReasonEnum.TASK_EXECUTION_ERROR.getReason()); - SpringContext.CONTEXT.publishEvent(new JobTaskFailAlarmEvent(taskExecute.getTaskBatchId())); + SpringContext.getContext().publishEvent(new JobTaskFailAlarmEvent(taskExecute.getTaskBatchId())); } finally { getContext().stop(getSelf()); } diff --git a/easy-retry-server/easy-retry-server-job-task/src/main/java/com/aizuda/easy/retry/server/job/task/support/handler/JobTaskBatchHandler.java b/easy-retry-server/easy-retry-server-job-task/src/main/java/com/aizuda/easy/retry/server/job/task/support/handler/JobTaskBatchHandler.java index 907e22e0..44b1a259 100644 --- a/easy-retry-server/easy-retry-server-job-task/src/main/java/com/aizuda/easy/retry/server/job/task/support/handler/JobTaskBatchHandler.java +++ b/easy-retry-server/easy-retry-server-job-task/src/main/java/com/aizuda/easy/retry/server/job/task/support/handler/JobTaskBatchHandler.java @@ -65,7 +65,7 @@ public class JobTaskBatchHandler { if (failCount > 0) { jobTaskBatch.setTaskBatchStatus(JobTaskBatchStatusEnum.FAIL.getStatus()); - SpringContext.CONTEXT.publishEvent(new JobTaskFailAlarmEvent(completeJobBatchDTO.getTaskBatchId())); + SpringContext.getContext().publishEvent(new JobTaskFailAlarmEvent(completeJobBatchDTO.getTaskBatchId())); } else if (stopCount > 0) { jobTaskBatch.setTaskBatchStatus(JobTaskBatchStatusEnum.STOP.getStatus()); } else { diff --git a/easy-retry-server/easy-retry-server-starter/src/main/java/com/aizuda/easy/retry/server/starter/server/RequestHandlerActor.java b/easy-retry-server/easy-retry-server-starter/src/main/java/com/aizuda/easy/retry/server/starter/server/RequestHandlerActor.java index 9ad51a2a..78f19a9b 100644 --- a/easy-retry-server/easy-retry-server-starter/src/main/java/com/aizuda/easy/retry/server/starter/server/RequestHandlerActor.java +++ b/easy-retry-server/easy-retry-server-starter/src/main/java/com/aizuda/easy/retry/server/starter/server/RequestHandlerActor.java @@ -104,7 +104,7 @@ public class RequestHandlerActor extends AbstractActor { } UrlBuilder builder = UrlBuilder.ofHttp(uri); - Collection httpRequestHandlers = SpringContext.CONTEXT + Collection httpRequestHandlers = SpringContext.getContext() .getBeansOfType(HttpRequestHandler.class).values(); for (HttpRequestHandler httpRequestHandler : httpRequestHandlers) { if (httpRequestHandler.supports(builder.getPathStr()) && method.name() diff --git a/easy-retry-server/easy-retry-server-web/src/main/java/com/aizuda/easy/retry/server/web/service/impl/DashBoardServiceImpl.java b/easy-retry-server/easy-retry-server-web/src/main/java/com/aizuda/easy/retry/server/web/service/impl/DashBoardServiceImpl.java index b41e1e5f..cad94a13 100644 --- a/easy-retry-server/easy-retry-server-web/src/main/java/com/aizuda/easy/retry/server/web/service/impl/DashBoardServiceImpl.java +++ b/easy-retry-server/easy-retry-server-web/src/main/java/com/aizuda/easy/retry/server/web/service/impl/DashBoardServiceImpl.java @@ -6,7 +6,6 @@ import com.aizuda.easy.retry.common.core.model.Result; import com.aizuda.easy.retry.common.core.util.JsonUtil; import com.aizuda.easy.retry.common.core.util.NetUtil; import com.aizuda.easy.retry.common.log.EasyRetryLog; -import com.aizuda.easy.retry.server.common.config.SystemProperties; import com.aizuda.easy.retry.server.common.dto.DistributeInstance; import com.aizuda.easy.retry.server.common.dto.ServerNodeExtAttrs; import com.aizuda.easy.retry.server.common.enums.DashboardLineEnum; @@ -34,6 +33,7 @@ import com.aizuda.easy.retry.template.datasource.persistence.mapper.JobSummaryMa import com.aizuda.easy.retry.template.datasource.persistence.mapper.RetrySummaryMapper; import com.aizuda.easy.retry.template.datasource.persistence.mapper.ServerNodeMapper; import com.aizuda.easy.retry.template.datasource.persistence.po.ServerNode; +import com.aizuda.easy.retry.template.datasource.utils.DbUtils; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.StringUtils; @@ -65,7 +65,6 @@ public class DashBoardServiceImpl implements DashBoardService { private static final String DASHBOARD_CONSUMER_BUCKET = "/dashboard/consumer/bucket"; - private final SystemProperties systemProperties; private final ServerNodeMapper serverNodeMapper; private final RestTemplate restTemplate; private final JobSummaryMapper jobSummaryMapper; @@ -131,7 +130,7 @@ public class DashBoardServiceImpl implements DashBoardService { // 重试任务列表 Page pager = new Page<>(baseQueryVO.getPage(), baseQueryVO.getSize()); // 针对SQL Server的分页COUNT, 自定义statement ID - if (DbTypeEnum.SQLSERVER.equals(systemProperties.getDbType())) { + if (DbTypeEnum.SQLSERVER == DbUtils.getDbType()) { pager.setCountId("sqlServer_jobTaskList_Count"); } IPage IPage = retrySummaryMapper.retryTaskList(namespaceId, groupNames, pager); @@ -167,7 +166,7 @@ public class DashBoardServiceImpl implements DashBoardService { // 重试任务列表 Page pager = new Page<>(baseQueryVO.getPage(), baseQueryVO.getSize()); // 针对SQL Server的分页COUNT, 自定义statement ID - if (DbTypeEnum.SQLSERVER.equals(systemProperties.getDbType())) { + if (DbTypeEnum.SQLSERVER == DbUtils.getDbType()) { pager.setCountId("sqlServer_jobTaskList_Count"); } // 任务类型