przodownikR1
przodownikR1
Reputation Top 5%
przodownikR1 @ Snip2Code
1 Snippet  (596th place)
Published
1 Channel
Created
2 Channels
Following
46 points  (632nd place)
Reputation
Junior Code Generator
Junior Autobiographer
Senior Autobiographer
Junior Wise Coder

Recent Snippets See all snippets by przodownikR1

public by przodownikR1  394838  1  3  0

example create datasource in javaConfig with full desc and params

example create datasource in javaConfig with full desc and params: db_config_full.java
@Bean
  public DataSource dataSource() {
    final DataSource dataSource = new DataSource();
    dataSource.setDriverClassName("com.mysql.jdbc.Driver");
    dataSource.setUrl(env.getProperty("jdbc.url"));
    dataSource.setUsername(env.getProperty("jdbc.username"));
    dataSource.setPassword(env.getProperty("jdbc.password"));
    dataSource.setTestOnBorrow(true);
    dataSource.setTestWhileIdle(true);
    dataSource.setTestOnReturn(false);
    dataSource.setValidationQuery("SELECT 1");
    dataSource.setValidationInterval(30000);
    dataSource.setTimeBetweenEvictionRunsMillis(5000);
    dataSource.setMaxActive(100);
    dataSource.setMinIdle(10);
    dataSource.setMaxWait(10000);
    dataSource.setInitialSize(10);
    dataSource.setRemoveAbandonedTimeout(3600);
    dataSource.setRemoveAbandoned(true);
    dataSource.setLogAbandoned(true);
    dataSource.setMinEvictableIdleTimeMillis(30000);
    return dataSource;
  }

;