fix: wire @Primary JdbcTemplate to the @Primary DataSource bean
The jdbcTemplate() method was calling dataSource(properties) directly, creating a new DataSource instance instead of using the Spring-managed @Primary bean. This caused some repositories to receive the ClickHouse connection instead of PostgreSQL. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -29,8 +29,8 @@ public class ClickHouseConfig {
|
|||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
@Primary
|
@Primary
|
||||||
public JdbcTemplate jdbcTemplate(DataSourceProperties properties) {
|
public JdbcTemplate jdbcTemplate(@Qualifier("dataSource") DataSource dataSource) {
|
||||||
return new JdbcTemplate(dataSource(properties));
|
return new JdbcTemplate(dataSource);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Bean(name = "clickHouseDataSource")
|
@Bean(name = "clickHouseDataSource")
|
||||||
|
|||||||
Reference in New Issue
Block a user