An error similar to the following occurred:
Severity: Exception sending context initialized event to listener instance of class Org.springframework.web.context.ContextLoad Erlistener
Org.springframework.beans.factory.BeanCreationException:
Error creating Bean with Name ' Userserviceimpl ': Injection of autowired dependencies failed;Nested exception is org.springframework.beans.factory.BeanCreationException:Could not Autowire field:private Cn.springmvc.dao.UserDAO Cn.springmvc.service.impl.UserServiceImpl.userDAO; Nested exception is Org.springframework.beans.factory.NoSuchBeanDefinitionException:No qualifying bean of type [ Cn.springmvc.dao.UserDAO] found for dependency:expected at least 1 beans which qualifies as Autowire candidate for this de Pendency. Dependency annotations: {@org. springframework.beans.factory.annotation.Autowired (Required=true)}
At Org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues ( autowiredannotationbeanpostprocessor.java:288)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean ( abstractautowirecapablebeanfactory.java:1116)
At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean ( abstractautowirecapablebeanfactory.java:519)
Possible causes:
1, whether in DAO, service, controller separately annotated
@Repository
@Service ("Xxxservice")
@Controller ("Xxxcontroller")
And
@Resource (name = "Xxxservice")
private Xxxservice xxxservice;
2. Whether the following components are configured in the Spring configuration file
<!--turn on the note processor--
<context:annotation-config/>
<!--enable spring MVC annotations, default annotation mapping support--
<mvc:annotation-driven/>
<context:component-scan base-package= "Com.xxx.xxx.dao,com.xxx.xxx.service,com.xxx.xxx.controller" >
</context:component-scan>
3. Check if the Web. xml file loads the spring and MyBatis configuration files
4. Check that the annotation name is consistent
5, check the Spring Profile Scan mapper and DAO interface is configured correctly
These details may be overlooked, although it is common to develop commonly used configurations, but if omitted, there will be errors, in the moment not to think of these