加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

通过类型为[java.lang.Class]的索引0的构造函数参数表示的不满意

发布时间:2020-12-15 01:42:03 所属栏目:大数据 来源:网络整理
导读:嗨,大家好我用hibernate和spring创建了一个简单的web应用程序,我想实现一个包含crud操作的抽象类,但是我有这个错误: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clientService' defined in class path reso

嗨,大家好我用hibernate和spring创建了一个简单的web应用程序,我想实现一个包含crud操作的抽象类,但是我有这个错误:

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'clientService' defined in class path resource [applicationContext.xml]: 
Cannot resolve reference to bean 'clientDao' while setting bean property 'clientDao'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: 
Error creating bean with name 'clientDao' defined in class path resource [applicationContext.xml]: 
Unsatisfied dependency expressed through constructor argument with index 0 of type [java.lang.Class]: 

GenericDao

public interface GenericDao

}

GenericDaoImpl

@Transactional
public  class GenericDaoImpl

ClientDao

public interface ClientDao  extends GenericDao

ClientDaoImpl

@Transactional
@Repository("clientDao")
public class ClientDaoImpl extends GenericDaoImpl

application context.xml

最佳答案
使用:

Spring会将字符串“强制转换”为类.然后,您可以从XML中删除客户端bean.

或者从ClientDaoImpl中删除此参数,因为它没用(它只能是这种类型,因此没有理由将其作为参数)

public ClientDaoImpl() {
    super(com.xxx.Client.class);
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读