提交 c1950882 编写于 作者: L lbw

Introducing new features. 适配动态数据源 3.3.x

上级 34ae6b2f
......@@ -64,6 +64,7 @@ public class JdbcDynamicDataSourceProvider extends AbstractJdbcDataSourceProvide
DataSourceProperty property = new DataSourceProperty();
property.setDriverClassName(DataSourceConstants.DS_DRIVER);
property.setUsername(username);
property.setLazy(true);
property.setPassword(stringEncryptor.decrypt(password));
property.setUrl(url);
map.put(name, property);
......@@ -74,6 +75,7 @@ public class JdbcDynamicDataSourceProvider extends AbstractJdbcDataSourceProvide
property.setUsername(properties.getUsername());
property.setPassword(properties.getPassword());
property.setUrl(properties.getUrl());
property.setLazy(true);
property.setDriverClassName(DataSourceConstants.DS_DRIVER);
map.put(DataSourceConstants.DS_MASTER, property);
return map;
......
......@@ -121,6 +121,7 @@ public class GenDatasourceConfServiceImpl extends ServiceImpl<GenDatasourceConfM
dataSourceProperty.setUsername(conf.getUsername());
dataSourceProperty.setPassword(conf.getPassword());
dataSourceProperty.setDriverClassName(DataSourceConstants.DS_DRIVER);
dataSourceProperty.setLazy(true);
DataSource dataSource = hikariDataSourceCreator.createDataSource(dataSourceProperty);
SpringContextHolder.getBean(DynamicRoutingDataSource.class).addDataSource(dataSourceProperty.getPoolName(),
dataSource);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册