SpringBoot报错The bean ‘XXXDao‘, defined in null, could not be registered,overriding is disabled的问题

完整问题描述:

The bean 'xxDao', defined in com.springboot.springbootdemo.dao.es.xxDao defined in @EnableElasticsearchRepositories declared on ElasticsearchRepositoriesRegistrar.EnableElasticsearchRepositoriesConfiguration, could not be registered. A bean with that name has already been defined in file [F:\workspace\java\SpringBootWorkSpace\target\classes\com\springboot\springbootdemo\dao\es\xxDao.class] and overriding is disabled.

具体报错内容如下:
SpringBoot报错The bean ‘XXXDao‘, defined in null, could not be registered,overriding is disabled的问题_第1张图片
提示解决办法:

Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true

所以在配置文件中加入以下配置:
SpringBoot报错The bean ‘XXXDao‘, defined in null, could not be registered,overriding is disabled的问题_第2张图片
解决以上报错问题。

你可能感兴趣的:(Java,程序人生,springboot,java,spring,boot)