java抽象类异常_java – 抽象类的自动连接依赖项注入失败

我使用的是Spring 3和Hibernate 4

我有以下类结构

public interface GenericDAO {

public void create(T entity);

public void update(T entity);

public void delete(T entity);

}

DAO班

public interface EmployeeDAO extends GenericDAO {

public void findEmployee(EmployeeQueryData data);

}

DAO实现类

@Repository("employeeDAO")

public abstract class EmployeeDAOImpl implements EmployeeDAO {

protected EntityManager entityManager;

@Override

public void findEmployee(EmployeeQueryData data) {

...... code

}

我面临的问题是当我尝试部署时,我得到以下异常.

如果我从EmployeeDAOImpl中删除摘要并删除扩展GenericDAO< Employee>从EmployeeDAO然后应用程序部署没有错误.因此,不可能为EmployeeDAOImpl提供抽象类,或者我需要在没有抽象的DAO实现中实现GenericDAO的所有方法?

Error creating bean with

name 'employeeService': Injection of autowired dependencies failed; \nnested exception is org.springframework.beans.factory.BeanCreationException:

Could not autowire field: test.dao.EmployeeDAO

test.service.EmployeeServiceImpl.employeeDAO; nested exception is

org.springframework.beans.factory.NoSuchBeanDefinitionException:

No matching bean of type [test.dao.EmployeeDAO] found for dependency:

expected at least 1 bean which qualifies as autowire candidate for

this dependency. Dependency annotations:

{@javax.inject.Inject()}.

编辑1

GenericDAOImpl

public class GenericDAOImpl implements GenericDAO {

public void create(T entity) {

}

public void update(T entity) {

}

public void delete(T entity) {

}

EmployeeDAOImpl

public class EmployeeDAOImpl extends GenericDAOImpl implements EmployeeDAO {

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值