• 错误:Bean property 'sessionFactory' is not writable or has an invalid setter method.


    Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'sessionFactory' of bean class [com.xk.dao.impl.ImplDepartmentDao]: Bean property 'sessionFactory' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
     at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:1060)
     at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:918)
     at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:82)
     at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:62)
     at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1489)
     ... 22 more

    原因:在配置文件中dao注入的时候,如果写了<property></property>属性,就必须写sessionFactory的setter和getter方法;

    解决办法:①删掉<property></property>属性

        ②添加setter和getter方法

      更改之后如下图:

      

  • 相关阅读:
    python值解析excel
    python 面向对象
    python之解析json
    python之数据驱动ddt
    Matlab笔记
    WPF应用Access数据库
    白平衡之灰度世界法与镜面法
    应用按位与操作,拆分字节
    WPF(C#)与MATLAB混合编程
    C++调用matlab函数
  • 原文地址:https://www.cnblogs.com/huike/p/7497984.html
Copyright © 2020-2023  润新知