private void createBean(ConfigurableListableBeanFactory configurableListableBeanFactory,
String prefixName, JdbcProperties jdbcProperties) {
String jdbcUrl = jdbcProperties.getJdbcUrl();
checkArgument(!Strings.isNullOrEmpty(jdbcUrl), prefixName + " url is null or empty");
log.info("prefixName is {}, jdbc properties is {}", prefixName, jdbcProperties);
HikariDataSource hikariDataSource = createHikariDataSource(jdbcProperties);
DataSourceSpy dataSource = new DataSourceSpy(hikariDataSource);
DataSourceTransactionManager transactionManager = new DataSourceTransactionManager(dataSource);
AnnotationTransactionAspect.aspectOf().setTransactionManager(transactionManager);
JdbcTemplate jdbcTemplate = new JdbcTemplate(dataSource);
register(configurableListableBeanFactory, dataSource, prefixName + "DataSource",
prefixName + "Ds");
register(configurableListableBeanFactory, jdbcTemplate, prefixName + "JdbcTemplate",
prefixName + "Jt");
register(configurableListableBeanFactory, transactionManager, prefixName + "TransactionManager",
prefixName + "Tx");
}
LocDataSourceAutoConfiguration.java 文件源码
java
阅读 27
收藏 0
点赞 0
评论 0
项目:loc-framework
作者:
评论列表
文章目录