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 ...
随机推荐
- PKU2503_map应用
Description You have just moved from Waterloo to a big city. The people here speak an incomprehensib ...
- MySQL从删库到跑路_高级(六)——索引
作者:天山老妖S 链接:http://blog.51cto.com/9291927 一.索引简介 1.索引简介 索引(Index)是帮助MySQL高效获取数据的数据结构. 在MySQL中,索引属于存储 ...
- Linux基础命令---split
split 将一个大文件切割成较小的文件,默认情况下每1000行就会切割一次.分割后的文件,默认以xaa.xab.xac等命名.用户亦可以指定名字的前缀,例如指定前缀test,那么分割后的文件是tes ...
- Eclipse中把Java工程修改成web工程
Eclipse中把Java工程修改成web工程 点击项目:右击:选择properties--输入project facets,将“Dynamic Web Module”打勾即可:
- 08: 查看Linux系统基本信息和硬盘CPU等
目录: 1.1 查看Linux系统基本信息 1.2 查看三秒内的平均CPU 1.3 查看内存使用情况 1.4 查看当前系统负载 1.1 查看Linux系统基本信息返回顶部 1.查看Linux系统uui ...
- Adobe漏洞攻击
Adobe漏洞攻击 windows ip 开启msfconsole 进入攻击模块 设置攻击载荷payload 设置相关参数 确定需要修改的参数 exploit生成5303.pdf 将pdf复制到靶机里 ...
- 20145312 《网络对抗》 Web安全基础实践
20145312 <网络对抗> Web安全基础实践 问题回答 SQL注入攻击原理,如何防御 原理:攻击者在web应用程序中事先定义好的查询语句的结尾上添加额外的SQL语句,把SQL语句当做 ...
- 20145321《网络对抗》Exp2 后门原理与实践
实验内容 (1)使用netcat获取主机操作Shell,cron启动 (2)使用socat获取主机操作Shell, 任务计划启动 (3)使用MSF meterpreter生成可执行文件,利用ncat或 ...
- 20165310 学习基础和C语言基础调查
学习基础和C语言基础调查 做中学体会 阅读做中学之后,了解老师关于五笔练习.减肥.乒乓和背单词的经历,不禁联想到自己学古筝的经历. 成功的经验 兴趣 我其实小时候学过一段时间古筝,但是那时候是因为父母 ...
- JAVA I/O(四)网络Socket和ServerSocket
<Thinking in Enterprise Java>中第一章描述了用Socket和Channel的网络编程,核心即为Socket和Channel,本文简单讲述Socket的应用. S ...