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

后端 未结 6 1911
南旧
南旧 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条回答
  •  失恋的感觉
    2021-02-18 14:49

    It seems you have two entityManagerFactory, one you will autowire and one you resolve programmatically as Bean:

    @Autowired
    private LocalContainerEntityManagerFactoryBean entityManagerFactory;
    
    @Bean
    public LocalContainerEntityManagerFactoryBean entityManagerFactory() {
    ...
    }
    

    I think you just need your configured Factory in entityManagerFactory() method.

提交回复
热议问题