-
Notifications
You must be signed in to change notification settings - Fork 364
Closed as not planned
Closed as not planned
Copy link
Labels
status: supersededAn issue that has been superseded by anotherAn issue that has been superseded by another
Description
In this repository, I've finally managed to configure repositories with multiple datasources and dialects (MySQL, PostgreSQL, Microsoft SQL Server), which goes like this:
- Create necessary beans with
@Qualifier
for each datasource - Create a repository factory class inheriting JdbcRepositoryFactoryBean that injects the
@Qualifier
-ed beans for each datasource - Use the repository factory class by specifying
repositoryFactoryBeanClass
of@EnableJdbcRepositories
for each datasource
But Bumping from 3.1.5 to 3.2.0-RC1, the application does not start by the following exception.
org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'org.springframework.data.jdbc.core.mapping.JdbcMappingContext' available: expected single matching bean but found 3: jdbcMappingContextDb1,jdbcMappingContextDb2,jdbcMappingContextDb3
I've defined 3 JdbcMappingContext beans for each datasource, but the application looks to assume a single JdbcMappingContext bean. It is likely due to this commit that changed the behavior.
Adding @Primary
to beans for a specific datasource will launch the application, but it results in using the wrong beans for repositories for another datasource.
Metadata
Metadata
Assignees
Labels
status: supersededAn issue that has been superseded by anotherAn issue that has been superseded by another