hikari添加metric

    @Bean
    @ConfigurationProperties(prefix = "spring.datasource.hikari")
    HikariDataSource dataSource(DataSourceProperties properties) {
        HikariDataSource dataSource = properties.initializeDataSourceBuilder()
            .type(HikariDataSource.class)
            .build();
        if (StringUtils.hasText(properties.getName())) {
            dataSource.setPoolName(properties.getName());
        }
        dataSource.setMetricRegistry(metricRegistry());
        return dataSource;
    }

    @Bean
    MetricRegistry metricRegistry() {
        return new MetricRegistry();
    }

你可能感兴趣的:(-------【Spring,Boot】)