Created
March 2, 2023 06:02
-
-
Save brianhsu/f05791fac623ba52e97511860c02c487 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
@Slf4j | |
public class DataSourceConfig { | |
@Bean | |
@Primary | |
@ConfigurationProperties(prefix = "spring.datasource.pws") | |
public DataSourceProperties pwdDataSourceProperties() { | |
return new DataSourceProperties(); | |
} | |
@Bean(name = "pwsDataSource") // As a bean object and named | |
public DataSource dataSource() { | |
DataSourceProperties first = pwdDataSourceProperties(); | |
DataSourceProperties second = pwdDataSourceProperties(); | |
return first.initializeDataSourceBuilder().build(); | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment