首页 > 编程语言 > 详细

解决 org.springframework.context.annotation.ConflictingBeanDefinitionException

时间:2020-09-30 16:46:47      阅读:733      评论:0      收藏:0      [点我收藏+]

Java web 项目启动时报错

报错信息:

Caused by: org.springframework.context.annotation.ConflictingBeanDefinitionException: Annotation-specified bean name ‘testService‘ for bean class [test.service.impl.TestServiceImpl] conflicts with existing, non-compatible bean definition of same name and class [test.service.impl.TestService]

 

通过搜索定位到时以下代码片段造成的报错。

代码片段:

1.ITestService 的实现类代码:
@Service("testService")
public class TestServiceImpl implements ITestService {
......
}

2.在Controller中使用代码:
@Autowired
private ITestService testService;

 

解决方法:

代码 1 和 2 中的 testService 冲突了,修改1和2中任意的名字即可解决

解决 org.springframework.context.annotation.ConflictingBeanDefinitionException

原文:https://www.cnblogs.com/etangyushan/p/13753942.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!