Bootstrap

Spring异常:Annotation-specified bean name.. for bean class ...

时间:2020-04-28

异常:

Annotation-specified bean name ‘DistrictServiceImpl’ for bean class [com.qiu.service.impl.DoctorDetailServiceImpl] conflicts with existing, non-compatible bean definition of same name and class [com.qiu.service.impl.DistrictServiceImpl]

情景:

项目新增一个业务逻辑的Impl类之后,项目就报错了。但出错比较容易找。

原因:

上网一搜,大概是Spring重命名问题。

然后对照我的项目中的注解,果然是新增的DistrictServiceImpl类@Service重名了。

由于Spring是在注解下按配置扫描的方式去创建对象的,那么两个重名的注解也就不成立了。


我的微信号: xiang20200106 ,欢迎大家找我聊天

— 【 THE END 】—

在这里插入图片描述

本公众号已经整理一套包含前端和后端的全套电子书教程,限时免费赠送,请在公众号里回复「电子书」获取!
;