同属姓名注入spring报错

Caused by: org.springframework.beans.factory.BeanCreationException: 
Error creating bean with name 'epAtreusEquipmentInfoServiceImpl': 
Injection of resource dependencies failed; 
nested exception is org.springframework.beans.factory.BeanNotOfRequiredTypeException:
Bean named 'redisService' is expected to be of type 'com.xiaojukeji.epower.atreus.biz.service.redis.ConnectorRedisService' 
but was actually of type 'com.xiaojukeji.epower.direct.core.service.RedisService'

异常出现的背景:

@Autowired
private RedisService redisService;
@Resource
private ConnectorRedisService redisService;

以上同属姓名同时出现即会报错

改成这个就不会报错,或者属姓名不相同也可以

@Autowired
private ConnectorRedisService redisService;
posted @ 2021-11-10 11:14  夜旦  阅读(62)  评论(0编辑  收藏  举报