org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loginService' defined in ServletContext resource [/WEB-INF/applicationContext-service.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'loginDao' of bean class [sys.service.impl.loginServiceImpl]: Bean property 'loginDao' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?请问这是什么错误呢?我的DAO只是继承了HibernateDaoSupport (public class loginDaoImpl extends HibernateDaoSupport implements loginDao{})还要添加什么方法吗?应该怎么写呢??

解决方案 »

  1.   

    增加这个属性loginDao的set方法,一定要写对
      

  2.   

    请问loginDao的set方法应该怎么写呢 呵呵 多谢指教
      

  3.   

    我在loginDao添加代码如下
    public void setSessionFacotry(SessionFactory sessionFacotry) {
    setSessionFactory(sessionFacotry);
    }可是还报上面那个错误呀?!
      

  4.   

    在这个loginService里面写setLoginDao方法
      

  5.   

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'loginService' defined in ServletContext resource [/WEB-INF/applicationContext-service.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'loginDao' of bean class [sys.service.impl.loginServiceImpl]: Bean property 'loginDao' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
    楼主 貌似 是你的  [/WEB-INF/applicationContext-service.xml]: 这个文件中配置有问题。要么就是你的
    [sys.service.impl.loginServiceImpl]: 这个类中没有指定 Does the parameter type of the setter match the return type of the getter?
    没找到 匹配的getter 和setter 方法 。。你看看我说这个几个地方吧
      

  6.   

    注入
    SessionFactory sessionFacotry;
    public void setSessionFacotry(SessionFactory sessionFacotry) {
    this.sessionFacotry = sessionFacotry;
    }