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方法

  更改之后如下图:

  

错误:Bean property 'sessionFactory' is not writable or has an invalid setter method.的更多相关文章

  1. org.springframework.beans.NotWritablePropertyException:Bean property 'xxxService' is not writable or has an invalid setter method.

    完整报错提示信息:Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'blogDe ...

  2. Bean property ‘mapperHelper’ is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

    spring boot 报错: Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property ...

  3. Bean property '**DAO' is not writable or has an invalid setter method

    ApplicationContext.xml中配置有问题,里面的bean的属性名称写错了. ApplicationContext.xml中写的是loginDAO,在java类里配置的bean却写成了l ...

  4. error: Bean property 'userDAO' is not writable or has an invalid setter method.

    使用Spring属性注入的方式,没有在ServiceImpl中setDao,导致程序报错 public class AddressServiceImpl implements IAddressServ ...

  5. Bean property 'transactionManagerBeanName' is not writable or has an invalid set

    [2017-02-07 11:38:48,458]-[localhost-startStop-1]-[org.springframework.beans.factory.support.Default ...

  6. Spring整合Hibernate报错:annotatedClasses is not writable or has an invalid setter method

    Spring 整合Hibernate时报错: org.springframework.beans.factory.BeanCreationException: Error creating bean ...

  7. dubbo-admin-2.5.3 运行报错: Bean property 'URIType' is not writable or has an invalid 解决方法

    因为 jdk 是1.8的版本,和 dubbo-admin 存在兼容性问题.所以报错: Bean property 'URIType' is not writable or has an invalid ...

  8. is not writable or has an invalid setter method错误的解决

    java中在配置spring时,遇到is not writable or has an invalid setter method的错误一般是命名方式的问题 需要写成private userInfoD ...

  9. Bean property XX&#39; is not writable or has an invalid setter method

    刚刚搞spring.property注入时遇到这个问题,百度一下.非常多人说是命名或者get set方法不一致的问题,可是这个我是知道的.写的时候也注意到这些.所以应该不是这个问题.以为是xml头写的 ...

随机推荐

  1. 设置vim支持gbk

    linux下的默认字符集是utf-8,但Windows下默认是GBK,如果我们在linux下打开Windows中的文件就很容乱码,可以通过下面的设置使vim支持GBK编码. 首先,确认你的系统中安装了 ...

  2. Python- 解决PIP下载安装速度慢

    让PIP源使用国内镜像,提升下载速度和安装成功率. 国外的源下载速度太慢,而且经常出现下载后安装出错问题.把PIP安装源替换成国内镜像,可以大幅提升下载速度,还可以提高安装成功率. 国内源: 新版ub ...

  3. Linux hostname设置,静态ip设置,hostname与静态ip相互映射

    1,hostname设置 永久设置: centos 7 下,切换到root 用户 vi /etc/hostname 输入要修改的hostname centos 6或者其他linux 系统,可能在/et ...

  4. C# 生成 COM控件

    C#编写COM组件 软件:Microsoft VisualStudio 2010 1.新建一个类库项目 2.将Class1.cs改为我们想要的名字(例如:MyClass.cs) 问是否同时给类改名,确 ...

  5. Html br 标签

    Html br 标签 <html> <body> <!-- br标签:跳到下一行--> <p>内<br />容</p> 注:br ...

  6. java限制map大小,并FIFO淘汰

    有时候需要往一个MAP中写入一些记录,但又怕无限制地写入会导致内存爆掉,所以得限制这个MAP的大小. 实现:LinkedHashMap提供了简单的方法. 首先,定义一个最大数,比如1000,然后new ...

  7. HBase scan setBatch和setCaching的区别

    HBase的查询实现只提供两种方式: 1.按指定RowKey获取唯一一条记录,get方法(org.apache.hadoop.hbase.client.Get) 2.按指定的条件获取一批记录,scan ...

  8. CF932E Team Work

    思路 第二类斯特林数和组合数推式子的题目 题目要求\(\sum_{i=1}^n \left(\begin{matrix}n \\ i \end{matrix} \right) i^k\) 一个性质 第 ...

  9. docker从容器里面拷文件到宿主机或从宿主机拷文件到docker容器里面

    1.从容器里面拷文件到宿主机? 答:在宿主机里面执行以下命令 docker cp 容器名:要拷贝的文件在容器里面的路径       要拷贝到宿主机的相应路径 示例: 假设容器名为testtomcat, ...

  10. IdentityServer4服务器配置

    Session认证和JWT(Json Web Token) Token认证就是基于JWT 1.Session认证 1. 用户输入其登录信息 2. 服务器验证信息是否正确,并创建一个session,然后 ...