use of org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvider in project spring-boot by spring-projects.
the class DataSourcePublicMetrics method initialize.
@PostConstruct
public void initialize() {
DataSource primaryDataSource = getPrimaryDataSource();
DataSourcePoolMetadataProvider provider = new DataSourcePoolMetadataProviders(this.providers);
for (Map.Entry<String, DataSource> entry : this.applicationContext.getBeansOfType(DataSource.class).entrySet()) {
String beanName = entry.getKey();
DataSource bean = entry.getValue();
String prefix = createPrefix(beanName, bean, bean.equals(primaryDataSource));
DataSourcePoolMetadata poolMetadata = provider.getDataSourcePoolMetadata(bean);
if (poolMetadata != null) {
this.metadataByPrefix.put(prefix, poolMetadata);
}
}
}
Aggregations