I am trying to setup DynamoDB locally with Spring Boot. Initially I got the setup working and was able to write/save to DynamoDB via a repository. From that point I added mo
I just stumbled across the same issue while trying to add a PostgreSQL database via spring-data-jdbc to an existing project wich was already using a MongoDB.
It seems like the problem was that the repositories for MongoDB and PostgreSQL were scanned by both modules (spring-mongo and spring-jdbc). They both try to create some beans and clash.
In my case the MongoDB repositories and the PostgreSQL repositories were in the same package.
The accepted answer solved the problem for me - but i kind of got a hint from this startup logs:
Finished Spring Data repository scanning in 319ms. Found 4 repository interfaces
Finished Spring Data repository scanning in 319ms. Found 5 repository interfaces
This is weird because i only have 1 repository for PostgreSQL and 4 for MongoDB.
I moved the PostgreSQL repository into a different package than the MongoDB repository and configured the base package of the PostgreSQL repositories to the new package. In my case:
@EnableJdbcRepositories(basePackageClasses = MyOnlyPostgreSQLRepository.class) // TODO: Use the real package or a dedicated base class
This solved the issue for me (no property set for bean overriding - which i prefer). The startups logs also show the correct amount of repositories now (1 and 4).