Skip to content

Instantly share code, notes, and snippets.

@phillipuniverse
Created May 31, 2018 13:41
Show Gist options
  • Save phillipuniverse/2bd00a2fa41312b749a0f6d7748050c4 to your computer and use it in GitHub Desktop.
Save phillipuniverse/2bd00a2fa41312b749a0f6d7748050c4 to your computer and use it in GitHub Desktop.
@Configuration
public class CustomDatabaseAutoConfiguration extends DatabaseAutoConfiguration {
protected DataSource buildDataSource() {
DatabaseDriver driver = DatabaseDriver.fromJdbcUrl(props.getUrl());
com.zaxxer.hikari.HikariDataSource ds = DataSourceBuilder
.create()
.username(props.getUser())
.password(props.getPassword())
.url(props.getUrl())
.driverClassName(driver.getDriverClassName())
.type(com.zaxxer.hikari.HikariDataSource.class)
.build();
// customize other DataSource settings
return ds;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment