List of usage examples for org.springframework.boot.autoconfigure.jdbc DataSourceProperties getUsername
public String getUsername()
From source file:com.teradata.benchto.driver.jdbc.MultipleDataSourcesConfiguration.java
private DataSource createDataSource(DataSourceProperties properties) { DriverManagerDataSource dataSource = new DriverManagerDataSource(); dataSource.setDriverClassName(properties.getDriverClassName()); dataSource.setUrl(properties.getUrl()); dataSource.setUsername(properties.getUsername()); dataSource.setPassword(properties.getPassword()); return dataSource; }
From source file:com.todo.backend.config.DatabaseConfiguration.java
@Bean(destroyMethod = "close") public DataSource dataSource(DataSourceProperties dataSourceProperties, CustomProperties customProperties) { log.debug("Initializing datasource..."); HikariConfig config = new HikariConfig(); config.setDataSourceClassName(dataSourceProperties.getDriverClassName()); config.addDataSourceProperty("url", dataSourceProperties.getUrl()); config.addDataSourceProperty("user", dataSourceProperties.getUsername()); config.addDataSourceProperty("password", dataSourceProperties.getPassword() == null ? "" : dataSourceProperties.getPassword()); // mysql specific config.addDataSourceProperty("cachePrepStmts", customProperties.getDatasource().isCachePrepStmts()); config.addDataSourceProperty("prepStmtCacheSize", customProperties.getDatasource().getPrepStmtCacheSize()); config.addDataSourceProperty("prepStmtCacheSqlLimit", customProperties.getDatasource().getPrepStmtCacheSqlLimit()); config.addDataSourceProperty("useServerPrepStmts", customProperties.getDatasource().isUseServerPrepStmts()); return new HikariDataSource(config); }