// Path: druid-spring-boot-actuator/druid-spring-boot-actuator-autoconfigure/src/main/java/com/github/trang/druid/actuate/DruidDataSourcePoolMetadata.java
// public class DruidDataSourcePoolMetadata extends AbstractDataSourcePoolMetadata<DruidDataSource> {
// 
//     public DruidDataSourcePoolMetadata(DruidDataSource dataSource) {
//         super(dataSource);
//     }
// 
//     @Override
//     public Integer getActive() {
//         return getDataSource().getActiveCount();
//     }
// 
//     @Override
//     public Integer getMax() {
//         return getDataSource().getMaxActive();
//     }
// 
//     @Override
//     public Integer getMin() {
//         return getDataSource().getMinIdle();
//     }
// 
//     @Override
//     public String getValidationQuery() {
//         return getDataSource().getValidationQuery();
//     }
// 
// }


import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.alibaba.druid.pool.DruidDataSource;
import com.github.trang.druid.actuate.DruidDataSourcePoolMetadata;
package com.github.trang.druid.actuate.autoconfigure;



/**
 * Druid Metadata 自动配置，适用于 Metrics，默认开启
 *
 * @author trang
 */
@Configuration
@ConditionalOnClass(DruidDataSource.class)
public class DruidDataSourceMetadataProviderConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public DataSourcePoolMetadataProvider dataSourcePoolMetadataProvider() {
        return (dataSource) -> {
            if (dataSource instanceof DruidDataSource) {
// Path: druid-spring-boot-actuator/druid-spring-boot-actuator-autoconfigure/src/main/java/com/github/trang/druid/actuate/DruidDataSourcePoolMetadata.java
// public class DruidDataSourcePoolMetadata extends AbstractDataSourcePoolMetadata<DruidDataSource> {
// 
//     public DruidDataSourcePoolMetadata(DruidDataSource dataSource) {
//         super(dataSource);
//     }
// 
//     @Override
//     public Integer getActive() {
//         return getDataSource().getActiveCount();
//     }
// 
//     @Override
//     public Integer getMax() {
//         return getDataSource().getMaxActive();
//     }
// 
//     @Override
//     public Integer getMin() {
//         return getDataSource().getMinIdle();
//     }
// 
//     @Override
//     public String getValidationQuery() {
//         return getDataSource().getValidationQuery();
//     }
// 
// }


// Path: druid-spring-boot-actuator/druid-spring-boot-actuator-autoconfigure/src/main/java/com/github/trang/druid/actuate/autoconfigure/DruidDataSourceMetadataProviderConfiguration.java
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.jdbc.metadata.DataSourcePoolMetadataProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.alibaba.druid.pool.DruidDataSource;
import com.github.trang.druid.actuate.DruidDataSourcePoolMetadata;

package com.github.trang.druid.actuate.autoconfigure;



/**
 * Druid Metadata 自动配置，适用于 Metrics，默认开启
 *
 * @author trang
 */
@Configuration
@ConditionalOnClass(DruidDataSource.class)
public class DruidDataSourceMetadataProviderConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public DataSourcePoolMetadataProvider dataSourcePoolMetadataProvider() {
        return (dataSource) -> {
            if (dataSource instanceof DruidDataSource) {
                return new DruidDataSourcePoolMetadata((DruidDataSource) dataSource);