This commit is contained in:
ajaxfan
2021-02-07 15:00:19 +08:00
parent 6ee5963c3f
commit 5015aa5e83
2 changed files with 35 additions and 1 deletions

View File

@ -0,0 +1,35 @@
package com.chinaunicom.mall.ebtp.project.config;
import javax.sql.DataSource;
import org.apache.ibatis.session.SqlSessionFactory;
import org.mybatis.spring.SqlSessionFactoryBean;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.alibaba.druid.pool.DruidDataSource;
import io.seata.rm.datasource.DataSourceProxy;
@Configuration
public class DataSourceProxyConfig {
@Bean
@ConfigurationProperties(prefix = "spring.datasource")
public DataSource dataSource() {
return new DruidDataSource();
}
@Bean
public DataSourceProxy dataSourceProxy(DataSource dataSource) {
return new DataSourceProxy(dataSource);
}
@Bean
public SqlSessionFactory sqlSessionFactoryBean(DataSourceProxy dataSourceProxy) throws Exception {
SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
sqlSessionFactoryBean.setDataSource(dataSourceProxy);
return sqlSessionFactoryBean.getObject();
}
}

View File

@ -267,7 +267,6 @@ public class ProjectSectionServiceImpl extends BaseServiceImpl<ProjectSectionMap
@Override
@Transactional(rollbackFor = Exception.class)
@GlobalTransactional
public boolean bidToTender(List<String> sectionIds) {
log.info("xid 2021-02-07:"+ RootContext.getXID());
UpdateWrapper<ProjectSection> updateWrapper = new UpdateWrapper<>();