springboot 解决 The bean 'userRepository', defined in null, could not be registered. A bean with that name has already been defined in file XXX and overriding is disabled.
1、springboot 启动时报错:
2019-02-20 14:59:58.226 INFO 10092 --- [ main] c.f.s.SpringbootssmApplication : Starting SpringbootssmApplication on DESKTOP-CI9APH3 with PID 10092 (C:\MyWork\workspace_idea\springbootssm\target\classes started by panchanggui in C:\MyWork\workspace_idea\springbootssm)
2019-02-20 14:59:58.230 INFO 10092 --- [ main] c.f.s.SpringbootssmApplication : No active profile set, falling back to default profiles: default
2019-02-20 14:59:59.155 INFO 10092 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2019-02-20 14:59:59.229 WARN 10092 --- [ main] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.support.BeanDefinitionOverrideException: Invalid bean definition with name 'userRepository' defined in null: Cannot register bean definition [Root bean: class [org.springframework.data.jpa.repository.support.JpaRepositoryFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null] for bean 'userRepository': There is already [Generic bean: class [org.mybatis.spring.mapper.MapperFactoryBean]; scope=singleton; abstract=false; lazyInit=false; autowireMode=2; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in file [C:\MyWork\workspace_idea\springbootssm\target\classes\com\fantasy\springbootssm\mapper\UserRepository.class]] bound.
2019-02-20 14:59:59.236 INFO 10092 --- [ main] ConditionEvaluationReportLoggingListener : Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2019-02-20 14:59:59.238 ERROR 10092 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : ***************************
APPLICATION FAILED TO START
*************************** Description: The bean 'userRepository', defined in null, could not be registered. A bean with that name has already been defined in file [C:\MyWork\workspace_idea\springbootssm\target\classes\com\fantasy\springbootssm\mapper\UserRepository.class] and overriding is disabled. Action: Consider renaming one of the beans or enabling overriding by setting spring.main.allow-bean-definition-overriding=true Process finished with exit code 1
2、解决办法:
在配置文件中添加:
spring.main.allow-bean-definition-overriding=true

springboot 解决 The bean 'userRepository', defined in null, could not be registered. A bean with that name has already been defined in file XXX and overriding is disabled.的更多相关文章
- Feign 报错:The bean 'service-producer.FeignClientSpecification', defined in null, could not be registered. A bean with that name has already been defined in null and overriding is disabled.
报错: 2019-09-17 20:34:47.635 ERROR 59509 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter : ******* ...
- 【Feign】@FeignClient相同名字错误 The bean 'xxx.FeignClientSpecification', defined in null, could not be registered
The bean 'xxx.FeignClientSpecification', defined in null, could not be registered. A bean with that ...
- Feign报错'xx.FeignClientSpecification', defined in null, could not be registered.
解决: 在application.yml中配置: spring: main: allow-bean-definition-overriding: true 参考:https://blog.csdn.n ...
- SpringBoot启动报错:ould not be registered. A bean with that name has already been defined in file and overriding is disabled.
SpringBoot启动报错 ***************************APPLICATION FAILED TO START*************************** Des ...
- A bean with that name has already been defined in class path resource [org/springframework/transaction/annotation/ProxyTransactionManagementConfiguration.class] and overriding is disabled
2019-12-19 13:26:17.594 WARN [main] o.s.boot.web.servlet.context.AnnotationConfigServletWebServerApp ...
- NullableKey:解决Dictionary中键不能为null的问题 zt
2012-12-29 02:26 by 老赵, 1745 visits 众所周知,.NET中Dictionary的键不能为null,否则会抛出NullReferenceException,这在某些时候 ...
- Springboot解决war包放到Tomcat服务器上404的特殊情况
Springboot解决war包放到Tomcat服务器上404的特殊情况 原文链接:https://www.cnblogs.com/blog5277/p/9330577.html 原文作者:博客园-- ...
- Springboot解决资源文件404,503等特殊报错,无法访问
Springboot解决资源文件404,503等特殊报错 原文链接:https://www.cnblogs.com/blog5277/p/9324609.html 原文作者:博客园--曲高终和寡 ** ...
- 解决spring中不同配置文件中存在name或者id相同的bean可能引起的问题
小总结: 如果启用组件扫描,bean名称不同时,Spring将尝试创建一个bean,即使该类的bean已经在spring-config.xml中定义了. 但是,如果在spring配置文件中定义的bea ...
随机推荐
- 174. Dungeon Game(动态规划)
The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. ...
- zw版【转发·台湾nvp系列Delphi例程】HALCON AngleLl
zw版[转发·台湾nvp系列Delphi例程]HALCON AngleLl procedure TForm1.Button1Click(Sender: TObject);var Row1, Row2 ...
- 20154312 曾林 Exp8 web基础
1.基础问题回答 1.1.什么是表单 1.2.浏览器可以解析运行什么语言 1.3.WebServer支持哪些动态语言 2.实践总结与体会 3.实践过程记录 ----3.1.Web前端:HTML基础 - ...
- linux常用命令:sort 命令
sort 命令是Linux系统下一种对文件排序的工具,sort 命令功能十分强大,是 Shell 脚本编程是常用的文件排序工具. 1.命令格式: sort [选项]... [文件]... 或:sort ...
- Js基础知识6-JavaScript匿名函数和闭包
匿名函数 1,把匿名函数赋值给变量 var test = function() { return 'guoyu'; }; alert(test);//test是个函数 alert(test()); 2 ...
- 编译安装vsftpd-3.0.2
编译安装vsftpd 首先下载源码包(我一般喜欢放在/home/test) 解压:tar -zxvf vsftpd-3.0.2.tar.gz 进入目录进行编译 cd vsftpd-3.0.2 编译之前 ...
- poj 1274 The Prefect Stall - 二分匹配
Time Limit: 1000MS Memory Limit: 10000K Total Submissions: 22736 Accepted: 10144 Description Far ...
- MIME协议(详解范例)
转载一:http://blog.csdn.net/bripengandre/article/details/2192982 转载二:http://blog.csdn.net/flfna/article ...
- Win32 文件拖拽
1.响应系统消息 WM_DROPFILES 2.在响应函数里面获取拖拽文件路径 LRESULT OnDropFiles(UINT uMsg, WPARAM wParam, LPARAM lParam ...
- 【传输对象】kafka传递实体类消息
工具类 负责对象字节数组的相互转换,传输数据用 package com.yq.utils; import java.io.ByteArrayInputStream; import java.io.By ...