debug
This commit is contained in:
@ -0,0 +1,47 @@
|
|||||||
|
package com.chinaunicom.mall.ebtp.project.config;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
|
import org.mybatis.spring.SqlSessionFactoryBean;
|
||||||
|
import org.mybatis.spring.transaction.SpringManagedTransactionFactory;
|
||||||
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Primary;
|
||||||
|
|
||||||
|
import com.alibaba.druid.pool.DruidDataSource;
|
||||||
|
|
||||||
|
import io.seata.rm.datasource.DataSourceProxy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据源代理
|
||||||
|
*
|
||||||
|
* @author wangzhongxiang
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
public class DataSourceConfiguration {
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
@ConfigurationProperties(prefix = "spring.datasource")
|
||||||
|
public DataSource druidDataSource() {
|
||||||
|
DruidDataSource druidDataSource = new DruidDataSource();
|
||||||
|
return druidDataSource;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Primary
|
||||||
|
@Bean("dataSource")
|
||||||
|
public DataSourceProxy dataSource(DataSource druidDataSource) {
|
||||||
|
return new DataSourceProxy(druidDataSource);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public SqlSessionFactory sqlSessionFactory(DataSourceProxy dataSourceProxy) throws Exception {
|
||||||
|
SqlSessionFactoryBean sqlSessionFactoryBean = new SqlSessionFactoryBean();
|
||||||
|
sqlSessionFactoryBean.setDataSource(dataSourceProxy);
|
||||||
|
sqlSessionFactoryBean.setTransactionFactory(new SpringManagedTransactionFactory());
|
||||||
|
|
||||||
|
return sqlSessionFactoryBean.getObject();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -24,33 +24,11 @@ spring:
|
|||||||
application:
|
application:
|
||||||
name: biz-service-ebtp-project
|
name: biz-service-ebtp-project
|
||||||
|
|
||||||
shardingsphere:
|
datasource:
|
||||||
datasource:
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
names: ds0
|
url: jdbc:mysql://10.242.31.158:3033/ebtp_mall_project?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
|
||||||
ds0:
|
password: root
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
username: root
|
||||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
|
||||||
username: root
|
|
||||||
password: root
|
|
||||||
jdbc-url: jdbc:mysql://10.242.31.158:3033/ebtp_mall_project?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
|
|
||||||
url: jdbc:mysql://10.242.31.158:3033/ebtp_mall_project?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
|
|
||||||
filters: stat,wall,log4j
|
|
||||||
maxActive: 20
|
|
||||||
initialSize: 1
|
|
||||||
maxWait: 60000
|
|
||||||
minIdle: 1
|
|
||||||
timeBetweenEvictionRunsMillis: 60000
|
|
||||||
minEvictableIdleTimeMillis: 300000
|
|
||||||
validationQuery: select 'x'
|
|
||||||
testWhileIdle: true
|
|
||||||
testOnBorrow: false
|
|
||||||
testOnReturn: false
|
|
||||||
poolPreparedStatements: true
|
|
||||||
maxOpenPreparedStatements: 20
|
|
||||||
connection-properties: druid.stat.merggSql=ture;druid.stat.slowSqlMillis=5000
|
|
||||||
props:
|
|
||||||
sql:
|
|
||||||
show: true
|
|
||||||
|
|
||||||
jackson:
|
jackson:
|
||||||
date-format: yyyy-MM-dd HH:mm:ss
|
date-format: yyyy-MM-dd HH:mm:ss
|
||||||
|
Reference in New Issue
Block a user