当前位置: 首页>>代码示例>>Java>>正文


Java DruidDataSource.setUseGlobalDataSourceStat方法代码示例

本文整理汇总了Java中com.alibaba.druid.pool.DruidDataSource.setUseGlobalDataSourceStat方法的典型用法代码示例。如果您正苦于以下问题:Java DruidDataSource.setUseGlobalDataSourceStat方法的具体用法?Java DruidDataSource.setUseGlobalDataSourceStat怎么用?Java DruidDataSource.setUseGlobalDataSourceStat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.alibaba.druid.pool.DruidDataSource的用法示例。


在下文中一共展示了DruidDataSource.setUseGlobalDataSourceStat方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: clusterDataSource

import com.alibaba.druid.pool.DruidDataSource; //导入方法依赖的package包/类
@ConfigurationProperties(prefix = "spring.datasource.cluster")
@Bean(name = "clusterDataSource")
public DataSource clusterDataSource() {
    DruidDataSource dataSource = new DruidDataSource();
    try {
        dataSource.setFilters("stat,wall,log4j");
        dataSource.setUseGlobalDataSourceStat(true);
    } catch (SQLException e) {
        //
    }
    return dataSource;
}
 
开发者ID:Lengchuan,项目名称:SpringBoot-Study,代码行数:13,代码来源:ClusterDruidDataSourceConfig.java

示例2: mysqlDataSource

import com.alibaba.druid.pool.DruidDataSource; //导入方法依赖的package包/类
public DataSource mysqlDataSource() throws Exception{
    DruidDataSource druidDataSource = new DruidDataSource();
    druidDataSource.setUrl(this.url);
    druidDataSource.setUsername(this.username);
    druidDataSource.setPassword(this.password);
    druidDataSource.setDriverClassName(this.driverClassName);
    druidDataSource.setInitialSize(this.initialSize);
    druidDataSource.setMaxActive(this.maxActive);
    druidDataSource.setMinIdle(this.minIdle);
    druidDataSource.setMaxWait(this.maxWait);
    druidDataSource.setTimeBetweenEvictionRunsMillis(this.timeBetweenEvictionRunsMillis);
    druidDataSource.setMinEvictableIdleTimeMillis(this.minEvictableIdleTimeMillis);
    druidDataSource.setValidationQuery(this.validationQuery);
    druidDataSource.setTestWhileIdle(this.testWhileIdle);
    druidDataSource.setTestOnBorrow(this.testOnBorrow);
    druidDataSource.setTestOnReturn(this.testOnReturn);
    druidDataSource.setPoolPreparedStatements(this.poolPreparedStatements);
    druidDataSource.setMaxPoolPreparedStatementPerConnectionSize(this.maxPoolPreparedStatementPerConnectionSize);
    druidDataSource.setFilters(this.filters);
    try {
        druidDataSource.setFilters("wall,stat");
        druidDataSource.setUseGlobalDataSourceStat(true);
        druidDataSource.init();
    } catch (Exception e) {
        throw new RuntimeException("load datasource error, dbProperties is :", e);
    }
    return druidDataSource;
}
 
开发者ID:YupaiTS,项目名称:docs-manage,代码行数:29,代码来源:DruidProperties.java

示例3: dataSource

import com.alibaba.druid.pool.DruidDataSource; //导入方法依赖的package包/类
@Bean     //声明其为Bean实例  
public DataSource dataSource(){  
    DruidDataSource datasource = new DruidDataSource();  
    datasource.setUrl(dbUrl);  
    datasource.setUsername(username);  
    datasource.setPassword(password);  
    datasource.setDriverClassName(driverClassName);  
	  
    //configuration  
    datasource.setInitialSize(initialSize);  
    datasource.setMinIdle(minIdle);  
    datasource.setMaxActive(maxActive);  
    datasource.setMaxWait(maxWait);  
    datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);  
    datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);  
    datasource.setValidationQuery(validationQuery);  
    datasource.setTestWhileIdle(testWhileIdle);  
    datasource.setTestOnBorrow(testOnBorrow);  
    datasource.setTestOnReturn(testOnReturn);  
    datasource.setPoolPreparedStatements(poolPreparedStatements);  
    datasource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);  
    datasource.setUseGlobalDataSourceStat(useGlobalDataSourceStat);  
    try {  
        datasource.setFilters(filters);  
    } catch (SQLException e) {  
        System.err.println("druid configuration initialization filter: "+ e);  
    }  
    datasource.setConnectionProperties(connectionProperties);  
    return datasource;  
}
 
开发者ID:ranji1221,项目名称:lemcloud,代码行数:31,代码来源:DruidConfig.java


注:本文中的com.alibaba.druid.pool.DruidDataSource.setUseGlobalDataSourceStat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。