當前位置: 首頁>>代碼示例>>Java>>正文


Java DruidDataSource.setConnectionProperties方法代碼示例

本文整理匯總了Java中com.alibaba.druid.pool.DruidDataSource.setConnectionProperties方法的典型用法代碼示例。如果您正苦於以下問題:Java DruidDataSource.setConnectionProperties方法的具體用法?Java DruidDataSource.setConnectionProperties怎麽用?Java DruidDataSource.setConnectionProperties使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.alibaba.druid.pool.DruidDataSource的用法示例。


在下文中一共展示了DruidDataSource.setConnectionProperties方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createDataSource

import com.alibaba.druid.pool.DruidDataSource; //導入方法依賴的package包/類
protected DataSource createDataSource() throws SQLException {
  // special
  DruidDataSource datasource = new DruidDataSource();
  datasource.setUrl(commonProperties.getUrl());
  datasource.setUsername(commonProperties.getUsername());
  datasource.setPassword(commonProperties.getPassword());
  // common
  datasource.setDriverClassName(commonProperties.getDriverClassName());
  datasource.setInitialSize(commonProperties.getInitialSize());
  datasource.setMinIdle(commonProperties.getMinIdle());
  datasource.setMaxActive(commonProperties.getMaxActive());
  datasource.setMaxWait(commonProperties.getMaxWait());
  datasource
      .setTimeBetweenEvictionRunsMillis(commonProperties.getTimeBetweenEvictionRunsMillis());
  datasource.setMinEvictableIdleTimeMillis(commonProperties.getMinEvictableIdleTimeMillis());
  datasource.setValidationQuery(commonProperties.getValidationQuery());
  datasource.setTestWhileIdle(commonProperties.isTestWhileIdle());
  datasource.setTestOnBorrow(commonProperties.isTestOnBorrow());
  datasource.setTestOnReturn(commonProperties.isTestOnReturn());
  datasource.setPoolPreparedStatements(commonProperties.isPoolPreparedStatements());
  datasource.setMaxPoolPreparedStatementPerConnectionSize(
      commonProperties.getMaxPoolPreparedStatementPerConnectionSize());
  datasource.setFilters(commonProperties.getFilters());
  datasource.setConnectionProperties(commonProperties.getConnectionProperties());
  return datasource;
}
 
開發者ID:venus-boot,項目名稱:saluki,代碼行數:27,代碼來源:SingleDataSourceConfig.java

示例2: dataSource

import com.alibaba.druid.pool.DruidDataSource; //導入方法依賴的package包/類
@Bean
public DataSource dataSource() {
	DruidDataSource druidDataSource = new DruidDataSource();

	/**
	 * 驅動配置
	 */
	druidDataSource.setDriverClassName(property.getDriverClassName());
	druidDataSource.setUrl(property.getUrl());
	druidDataSource.setUsername(property.getUsername());
	druidDataSource.setPassword(property.getPassword());

	/**
	 * 其它鏈接池配置自行完成
	 */
	druidDataSource.setConnectionProperties(property.getConnectionProperties());

	try {
		druidDataSource.setFilters(property.getFilters());
	} catch (SQLException e) {
		log.error("druid configuration initialization filter", e);
	}

	return druidDataSource;
}
 
開發者ID:sdc1234,項目名稱:zhihu-spider,代碼行數:26,代碼來源:DatasourceConfiguration.java

示例3: dataSource

import com.alibaba.druid.pool.DruidDataSource; //導入方法依賴的package包/類
@Bean     //聲明其為Bean實例
@Primary  //在同樣的DataSource中,首先使用被標注的DataSource
public DataSource dataSource() {
    DruidDataSource datasource = new DruidDataSource();
    datasource.setUrl(url);
    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);
    try {
        datasource.setFilters(filters);
    } catch (SQLException e) {
    	logger.error("druid configuration initialization filter: {}",e);
    }
    datasource.setConnectionProperties(connectionProperties);
    return datasource;
}
 
開發者ID:yanghuijava,項目名稱:elephant,代碼行數:31,代碼來源:DruidConfiguration.java

示例4: dataSource

import com.alibaba.druid.pool.DruidDataSource; //導入方法依賴的package包/類
@Bean
@Primary
public DataSource dataSource() {
  DruidDataSource datasource = new DruidDataSource();
  datasource.setUrl(this.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);
  try {
    datasource.setFilters(filters);
  } catch (SQLException e) {
    logger.error("druid configuration initialization filter", e);
  }
  datasource.setConnectionProperties(connectionProperties);

  return datasource;
}
 
開發者ID:venus-boot,項目名稱:saluki,代碼行數:32,代碼來源:DataSourceConfiguration.java

示例5: dataSource

import com.alibaba.druid.pool.DruidDataSource; //導入方法依賴的package包/類
@Bean
@Primary
public DataSource dataSource() {
    DruidDataSource datasource = new DruidDataSource();
    datasource.setUrl(url);
    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);
    try {
        datasource.setFilters(filters);
    } catch (SQLException e) {
        System.err.println("druid configuration initialization filter: " + e);
    }
    datasource.setConnectionProperties(connectionProperties);
    return datasource;
}
 
開發者ID:ling49043171,項目名稱:mark-framework,代碼行數:31,代碼來源:DruidConfiguration.java

示例6: dataSource

import com.alibaba.druid.pool.DruidDataSource; //導入方法依賴的package包/類
@Bean     //聲明其為Bean實例  
@Primary  //在同樣的DataSource中,首先使用被標注的DataSource  
public DataSource dataSource() {
    DruidDataSource datasource = new DruidDataSource();

    datasource.setUrl(this.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);
    try {
        datasource.setFilters(filters);
    } catch (SQLException e) {
        logger.error("druid configuration initialization filter", e);
    }
    datasource.setConnectionProperties(connectionProperties);

    return datasource;
}
 
開發者ID:wooui,項目名稱:springboot-training,代碼行數:33,代碼來源:DruidDBConfig.java

示例7: 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

示例8: dataSource

import com.alibaba.druid.pool.DruidDataSource; //導入方法依賴的package包/類
@Bean
@Primary
public DataSource dataSource(){
    DruidDataSource datasource = new DruidDataSource();

    datasource.setUrl(this.dbUrl);
    datasource.setUsername(username);
    datasource.setPassword(password);
    datasource.setDriverClassName(driverClassName);
    //configuration
    if(initialSize != null) {
        datasource.setInitialSize(initialSize);
    }
    if(minIdle != null) {
        datasource.setMinIdle(minIdle);
    }
    if(maxActive != null) {
        datasource.setMaxActive(maxActive);
    }
    if(maxWait != null) {
        datasource.setMaxWait(maxWait);
    }
    if(timeBetweenEvictionRunsMillis != null) {
        datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
    }
    if(minEvictableIdleTimeMillis != null) {
        datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
    }
    if(validationQuery!=null) {
        datasource.setValidationQuery(validationQuery);
    }
    if(testWhileIdle != null) {
        datasource.setTestWhileIdle(testWhileIdle);
    }
    if(testOnBorrow != null) {
        datasource.setTestOnBorrow(testOnBorrow);
    }
    if(testOnReturn != null) {
        datasource.setTestOnReturn(testOnReturn);
    }
    if(poolPreparedStatements != null) {
        datasource.setPoolPreparedStatements(poolPreparedStatements);
    }
    if(maxPoolPreparedStatementPerConnectionSize != null) {
        datasource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);
    }

    if(connectionProperties != null) {
        datasource.setConnectionProperties(connectionProperties);
    }

    List<Filter> filters = new ArrayList<>();
    filters.add(statFilter());
    filters.add(wallFilter());
    datasource.setProxyFilters(filters);

    return datasource;
}
 
開發者ID:zhaoqicheng,項目名稱:renren-fast,代碼行數:59,代碼來源:DruidConfig.java

示例9: dataSource

import com.alibaba.druid.pool.DruidDataSource; //導入方法依賴的package包/類
@Bean     //聲明其為Bean實例
@Primary  //在同樣的DataSource中,首先使用被標注的DataSource

public DataSource dataSource(){
    DruidDataSource datasource = new DruidDataSource();

    datasource.setUrl(this.dbUrl);
    datasource.setUsername(username);
    datasource.setPassword(password);
    datasource.setDriverClassName(driverClassName);
    //configuration
    if(initialSize != null) {
        datasource.setInitialSize(initialSize);
    }
    if(minIdle != null) {
        datasource.setMinIdle(minIdle);
    }
    if(maxActive != null) {
        datasource.setMaxActive(maxActive);
    }
    if(maxWait != null) {
        datasource.setMaxWait(maxWait);
    }
    if(timeBetweenEvictionRunsMillis != null) {
        datasource.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
    }
    if(minEvictableIdleTimeMillis != null) {
        datasource.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
    }
    if(validationQuery!=null) {
        datasource.setValidationQuery(validationQuery);
    }
    if(testWhileIdle != null) {
        datasource.setTestWhileIdle(testWhileIdle);
    }
    if(testOnBorrow != null) {
        datasource.setTestOnBorrow(testOnBorrow);
    }
    if(testOnReturn != null) {
        datasource.setTestOnReturn(testOnReturn);
    }
    if(poolPreparedStatements != null) {
        datasource.setPoolPreparedStatements(poolPreparedStatements);
    }
    if(maxPoolPreparedStatementPerConnectionSize != null) {
        datasource.setMaxPoolPreparedStatementPerConnectionSize(maxPoolPreparedStatementPerConnectionSize);
    }
    if(filters != null) {
        try {
            datasource.setFilters(filters);
        } catch (SQLException e) {
            logger.error("druid configuration initialization filter", e);
        }
    }
    if(connectionProperties != null) {
        datasource.setConnectionProperties(connectionProperties);
    }
    return datasource;
}
 
開發者ID:guolf,項目名稱:pds,代碼行數:60,代碼來源:DruidConfig.java


注:本文中的com.alibaba.druid.pool.DruidDataSource.setConnectionProperties方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。