问题:
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘queueRemindJob’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.witontek.ehospital.service.clinic.IQueueRemindService com.witontek.ehospital.job.impl.QueueRemindJob.queueRemindService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘queueRemindServiceImpl’: Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.witontek.ehospital.service.base.ISendTemplateMsgService com.witontek.ehospital.service.clinic.impl.QueueRemindServiceImpl.sendTemplateMsgService; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [com.witontek.ehospital.service.base.ISendTemplateMsgService] is defined: expected single matching bean but found 2: sendAlipayTemplateMsgService,sendWechatTemplateMsgService
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:292)
at
问题原因:一个接口,被两个类所实现,又被如下注解
@Autowired
private ISendMsgService sendMsgService;
修改方法:
@Autowired
@Qualifier("sendWeChatMsgService")
private ISendMsgService sendWeChatMsgService;
@Autowired
@Qualifier("sendAPPMsgService")
private ISendMsgService sendAPPMsgService;
成功!