Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save sachin-handiekar/af78e8f54da3c529fc9cdc35230dbb3c to your computer and use it in GitHub Desktop.
Save sachin-handiekar/af78e8f54da3c529fc9cdc35230dbb3c to your computer and use it in GitHub Desktop.
public static DataSource createFlexyPoolDataSource() {
BasicDataSource basicDataSource = (BasicDataSource) DataSourceConfig.getDataSource();
Configuration<BasicDataSource> configuration = new Configuration.Builder<>(
"myFlexyPool", basicDataSource, BasicDataSourcePoolAdapter.FACTORY
).build();
return new FlexyPoolDataSource<>(configuration);
}
public static JdbcTemplate createJdbcTemplate() {
DataSource flexyPoolDataSource = createFlexyPoolDataSource();
return new JdbcTemplate(flexyPoolDataSource);
}
<dependency>
<groupId>com.vladmihalcea.flexy</groupId>
<artifactId>flexy-pool-core</artifactId>
<version>2.1.1</version>
</dependency>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment