异常-------------------------------------> Error creating bean with name 'employeeHandler': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreation

springmvc报错:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'employeeHandler': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.atguigu.springmvc.dao.EmployeeDao com.atguigu.springmvc.handler.EmployeeHandler.employeeDao; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.atguigu.springmvc.dao.EmployeeDao] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

 

在引用DAO属性处添加注解, 在DAO中添加注解@Repository

@Autowired

private EmployeeDao employeeDao;

 

@Repository
public class EmployeeDao {

 

posted @ 2017-03-20 18:58  半生戎马,共话桑麻、  阅读(367)  评论(0)    收藏  举报
levels of contents