From d9adbadd9fa14cb7174f6167c438a45e8176fd26 Mon Sep 17 00:00:00 2001 From: SZH <szh_hello@163.com> Date: 星期四, 23 二月 2023 15:22:04 +0800 Subject: [PATCH] 数据库连接池移除druid atomikos分布式事务使用com.mysql.cj.jdbc.MysqlXADataSource --- safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/MyBatisConfigEmergency.java | 14 +++----------- 1 files changed, 3 insertions(+), 11 deletions(-) diff --git a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/MyBatisConfigEmergency.java b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/MyBatisConfigEmergency.java index 05ae1c5..2173896 100644 --- a/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/MyBatisConfigEmergency.java +++ b/safePlatfrom-out-web/src/main/java/com/gkhy/safePlatform/config/database/MyBatisConfigEmergency.java @@ -1,7 +1,5 @@ package com.gkhy.safePlatform.config.database; -import com.alibaba.druid.pool.DruidDataSource; -import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceBuilder; import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor; import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean; import org.apache.ibatis.plugin.Interceptor; @@ -37,14 +35,8 @@ @Autowired private MybatisPlusInterceptor mybatisPlusInterceptor; - @Bean(name = "dataSourceEmergency") - @ConfigurationProperties(prefix = "spring.datasource.emergency") - public DruidDataSource dataSourceDoublePrevent(){ - return DruidDataSourceBuilder.create().build(); - } - @Bean(name = "sqlSessionFactoryEmergency") - public SqlSessionFactory sqlSessionFactoryEmergency(@Qualifier("dataSourceEmergency") DruidDataSource dataSource) throws Exception { + public SqlSessionFactory sqlSessionFactoryEmergency() throws Exception { MybatisSqlSessionFactoryBean factoryBean = new MybatisSqlSessionFactoryBean(); factoryBean.setDataSource(dsEmergency); ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); @@ -56,7 +48,7 @@ } @Bean - public SqlSessionTemplate sqlSessionTemplateEmergency(@Qualifier("sqlSessionFactoryEmergency") SqlSessionFactory sqlSessionFactory){ - return new SqlSessionTemplate(sqlSessionFactory); + public SqlSessionTemplate sqlSessionTemplateEmergency() throws Exception { + return new SqlSessionTemplate(sqlSessionFactoryEmergency()); } } -- Gitblit v1.9.2