2 reg user reg_User 于 2014.12.09 15:32 提问

No unique bean of type [] is defined

这是错误信息
No unique bean of type [com.home.web.AbsCrudDaoImpl] is defined: expected single matching bean but found 3: [agoodsCategoryDao, agoodsInfoDao, generateDao]
我是写了一个公共的dao类,然后继承这个类,下面是类一些的代码:
public class AbsCrudDaoImpl extends HibernateDaoFactory{

public Object get(Class clazz, Serializable id) throws DataAccessException {
    return getHibernateTemplate().get(clazz, id);
}

public Object load(Class clazz, Serializable id) throws DataAccessException {
    return getHibernateTemplate().load(clazz, id);
}

public Integer save(Object entity) throws DataAccessException {
    return (Integer) getHibernateTemplate().save(entity);
}
....
public class AbsCrudService<DAO extends AbsCrudDaoImpl> {

protected DAO absCrudDao;

public DAO getAbsCrudDao() {
    return absCrudDao;
}

@Resource
public void setAbsCrudDao(DAO absCrudDao) {
    this.absCrudDao = absCrudDao;
}

public Integer save(Object entity) throws DataAccessException {
    return (Integer) absCrudDao.save(entity);
}
....
public class AbsCurdController<Service extends AbsCrudService<?>> {

private static final long serialVersionUID = 1L;

protected Service service;

public Service getService() {
    return service;
}

@Resource
public void setService(Service service) {
    this.service = service;
}

1个回答

wangyaninglm
wangyaninglm   Ds   Rxr 2014.12.09 20:45

数组没有定义?我也看的一知半解的

Csdn user default icon
上传中...
上传图片
插入图片
准确详细的回答,更有利于被提问者采纳,从而获得C币。复制、灌水、广告等回答会被删除,是时候展现真正的技术了!