SpringBoot - BeanDefinitionOverrideException: Invalid bean definition

前端 未结 4 967
情话喂你
情话喂你 2020-12-03 04:28

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

4条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-03 04:50

    I think I had the same problem with MongoDB. At least the error message looked exactly the same and I also had just one repository for the MongoDB, something like this:

    public interface MyClassMongoRepository extends MongoRepository {
    }
    

    The problem had been caused by class MyClass which had been used in another database before. Spring silently created some JpaRepository before creating the MongoRepository. Both repositories had the same name which caused the conflict.

    Solution was to make a copy of MyClass, move it into the package of the MongoRepository and remove any JPA-specific annotations.

提交回复
热议问题