Skip to content

Instantly share code, notes, and snippets.

@CheolhoJeon
Created April 28, 2020 06:18
Show Gist options
  • Save CheolhoJeon/4d0e760b18385a8320329f038e8bbf3a to your computer and use it in GitHub Desktop.
Save CheolhoJeon/4d0e760b18385a8320329f038e8bbf3a to your computer and use it in GitHub Desktop.
package config;
import org.apache.tomcat.jdbc.pool.DataSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Profile;
@Configuration
@Profile("dev")
public class DsDevConfig {
@Bean(destroyMethod = "close")
public DataSource dataSource() {
DataSource ds = new DataSource();
ds.setDriverClassName("org.postgresql.Driver");
ds.setUrl("jdbc:postgresql://localhost:5432/spring5fs");
ds.setUsername("charlie");
ds.setPassword("charlie123");
ds.setInitialSize(2);
ds.setMaxActive(10);
ds.setTestWhileIdle(true);
ds.setMinEvictableIdleTimeMillis(60000 * 3);
ds.setTimeBetweenEvictionRunsMillis(10 * 1000);
return ds;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment