class ShardingDbInit {

    public void init(BeanDefinitionRegistry registry, List<DataSourceCfg> dataSourceCfgList,
              Map<String, ZebraShardingDataSourceCfg> zebraShardingDataSourceConfigurationMap) {

        if (MapUtils.isEmpty(zebraShardingDataSourceConfigurationMap)) {
            LOGGER.info("There is no sharding configuration.");
            return;
        }

        String dataSourceNames = String.join(",", zebraShardingDataSourceConfigurationMap.keySet());
        LOGGER.info("Sharding data source name is/are [{}].", dataSourceNames);
        LOGGER.info("Begin to create and register related bean definitions of sharding data sources.");

        // 初始化相关的数据源及相关bean
        initDataSources(registry, dataSourceCfgList, zebraShardingDataSourceConfigurationMap);

        // 初始化ShardingTracer，以便上报到APM系统
        ShardingTracer.init(ZebraOpenTracingTracer.getInstance());

        LOGGER.info("Finish to create and register related bean definitions of sharding data sources.");
    }

}