Skip to content
Advertisement

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

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 @Configuration annotated classes helping to set up Thymeleaf, Spring Security and Web. Why is the application trying to setup the homeController twice? (and where is it trying to do this?)

The error is:

JavaScript

My spring boot main application initializer:

JavaScript

My database config file:

JavaScript

My Thymeleaf config file:

JavaScript

}

My Web config class:

JavaScript

My controller (where there is an error setting up the controller)

JavaScript

What might be causing the ConflictingBeanDefinitionException error for my controller class?

Advertisement

Answer

The solution, as I found out, is to disable double initialization by including a filter in the component scan. In my case:

JavaScript
User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement