use of io.mycat.datasource.jdbc.DatasourceProvider in project Mycat2 by MyCATApache.
the class JdbcConnectionManager method createDatasourceProvider.
private static DatasourceProvider createDatasourceProvider(String customerDatasourceProvider) {
String defaultDatasourceProvider = Optional.ofNullable(customerDatasourceProvider).orElse(DruidDatasourceProvider.class.getName());
try {
DatasourceProvider o = (DatasourceProvider) Class.forName(defaultDatasourceProvider).getDeclaredConstructor().newInstance();
ServerConfig serverConfig = MetaClusterCurrent.exist(ServerConfig.class) ? MetaClusterCurrent.wrapper(ServerConfig.class) : new ServerConfig();
o.init(serverConfig);
return o;
} catch (Exception e) {
throw new MycatException("can not load datasourceProvider:{}", customerDatasourceProvider);
}
}
Aggregations