Spring Boot ConflictingBeanDefinitionException: Annotation-specified bean name for @Controller class

后端 未结 6 1915
南旧
南旧 2021-02-18 13:50

I keep getting the ConflictingBeanDefinitionException error in my Spring boot application. I am not entirely sure as to how to address it, I have several @Con

6条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-02-18 14:37

    I had the same problem on a Spring integration test when I ran it with InteliJ.

    After a refactor, one of my controller class was actually duplicate in the /out/production/classes directory which is the default output directory for Intelij since version 2017.2. Since the gradle output directory is different (It's build/classes), the gradle clean goal had no effect.

    For me the solution was to manually remove /out/production/classes and re run my integration test.

    For a possible durable solution not having 2 output directories see here

提交回复
热议问题