Closed
Description
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 singleCustomConversions
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 justCustomConversions
.
Referenced from: pull request #89