-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
yongjingchuan
authored and
yongjingchuan
committed
Aug 19, 2020
1 parent
e3680ac
commit e3b523e
Showing
2 changed files
with
110 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/main/java/com/cy/generate/common/builder/DataSourceOneConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
package com.cy.generate.common.builder; | ||
|
||
/** | ||
* @Description: | ||
* @Author: YongJingChuan | ||
* @Date: 2020/8/19 19:46 | ||
*/ | ||
//@Configuration | ||
//@MapperScan(basePackages = {"xxx.xxx.xxx", "xxx.xxx.xxx"}, sqlSessionTemplateRef = "sqlSessionTemplate1") | ||
public class DataSourceOneConfig { | ||
|
||
// @Bean(name = "dbProperties1") | ||
// @ConfigurationProperties(prefix = "datasource.cds.data1") | ||
// public DataSourceProperties dataSourceProperties() { | ||
// return new DataSourceProperties(); | ||
// } | ||
// | ||
// @Bean(name = "datasource1") | ||
// @Primary | ||
// public DataSource dataSource(@Qualifier(value = "dbProperties1") DataSourceProperties dataSourceProperties) { | ||
// System.out.println(dataSourceProperties); | ||
// DriverManagerDataSource dataSource = new DriverManagerDataSource(); | ||
// dataSource.setDriverClassName(dataSourceProperties.getDriverClassName()); | ||
// dataSource.setUrl(dataSourceProperties.getUrl()); | ||
// Properties properties = new Properties(); | ||
// properties.setProperty("dbpool.class", dataSourceProperties.getDbpoolClass()); | ||
// properties.setProperty("dbpool.minIdle", dataSourceProperties.getDbpoolMinimumIdle()); | ||
// properties.setProperty("dbpool.maximumPoolSize", dataSourceProperties.getDbpoolMaximumPoolSize()); | ||
// properties.setProperty("dbpool.maxLifetime", dataSourceProperties.getDbpoolMaxLifetime()); | ||
// properties.setProperty("dbpool.connectionTimeout", dataSourceProperties.getDbpoolConnectionTimeout()); | ||
// properties.setProperty("dbpool.idleTimeout", dataSourceProperties.getDbpoolIdleTimeout()); | ||
// properties.setProperty("wycds.sql", dataSourceProperties.getWycdsSql()); | ||
// properties.setProperty("wycds.jdbclog", dataSourceProperties.getWycdsJdbclog()); | ||
// properties.setProperty("wycds.range.compare", dataSourceProperties.getWycdsRangeCompare()); | ||
// properties.setProperty("wycds.route2all", dataSourceProperties.getWycdsRoute2all()); | ||
// properties.setProperty("wycds.wycp.decoding", dataSourceProperties.getWycdsWycpDecoding()); | ||
// dataSource.setConnectionProperties(properties); | ||
// return dataSource; | ||
// } | ||
// | ||
// @Bean(name = "sessionFactory1") | ||
// @Primary | ||
// public SqlSessionFactory sqlSessionFactory(@Qualifier(value = "datasource1") DataSource dataSource) throws Exception { | ||
// MybatisSqlSessionFactoryBean bean = new MybatisSqlSessionFactoryBean(); | ||
// bean.setDataSource(dataSource); | ||
// return bean.getObject(); | ||
// } | ||
// | ||
// @Bean(name = "transactionManager1") | ||
// @Primary | ||
// public DataSourceTransactionManager dataSourceTransactionManager(@Qualifier("datasource1") DataSource dataSource) { | ||
// return new DataSourceTransactionManager(dataSource); | ||
// } | ||
// | ||
// @Bean(name = "sqlSessionTemplate1") | ||
// @Primary | ||
// public SqlSessionTemplate sqlSessionTemplate(@Qualifier("sessionFactory1") SqlSessionFactory sqlSessionFactory) { | ||
// return new SqlSessionTemplate(sqlSessionFactory); | ||
// } | ||
} |