/** * 基于dbGroupKey、appName来初始化多个TAtomDataSource * * @throws com.taobao.tddl.jdbc.group.exception.ConfigException */ public void init() { if (dsKeyAndWeightCommaArray != null) { // 本地配置方式:dsKeyAndWeightCommaArray + dataSourceFetcher + dyType DataSourceFetcher wrapper = new DataSourceFetcher() { @Override public DataSource getDataSource(String key) { return dataSourceFetcher.getDataSource(key); } @Override public DBType getDataSourceDBType(String key) { DBType type = dataSourceFetcher.getDataSourceDBType(key); return type == null ? dbType : type; // 如果dataSourceFetcher没dbType,用tgds的dbType } }; List<DataSourceWrapper> dss = ConfigManager.buildDataSourceWrapper(dsKeyAndWeightCommaArray, wrapper); init(dss); } else { checkProperties(); configManager = new ConfigManager(this); configManager.init(); } }
public void init(List<DataSourceWrapper> dataSourceWrappers) { configManager = new ConfigManager(this); configManager.init(dataSourceWrappers); }