Skip to content

Fix Jdbc configuration to support multiple stores [DATAJDBC-267] #491

Closed
@spring-projects-issues

Description

@spring-projects-issues

Jens Schauder opened DATAJDBC-267 and commented

Andy Wilkinson in Slack:

I’m working on auto-configuration for Spring Data JDBC, and I think I’ve found a bug. JdbcConfiguration injects a single CustomConversions bean. If you’ve got more than one store on the classpath, it’ll fail with something like this:

Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'jdbcMappingContext' defined in class path resource [org/springframework/boot/autoconfigure/data/jdbc/JdbcRepositoriesAutoConfiguration$SpringBootJdbcConfiguration.class]: Unsatisfied dependency expressed through method 'jdbcMappingContext' parameter 1; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type 'org.springframework.data.convert.CustomConversions' available: expected single matching bean but found 3: jdbcCustomConversions,mongoCustomConversions,redisCustomConversions
 at org.springframework.beans.factory.support.ConstructorResolver.createArgumentArray(ConstructorResolver.java:767)
 …

I wonder if both the bean definition and the injection points should be more precisely typed and use JdbcCustomConversions rather than just CustomConversions.


Referenced from: pull request #89

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions