搭建框架遇到SessionFactory is not writable or has an invalid setter method的问题
来源:互联网 发布:怎么开淘宝天猫店 编辑:程序博客网 时间:2024/05/08 23:40
近几日搭建框架,遇到sessionFactory报错,在Spring配置文件中向dao层中注入时报的错:
Caused by: org.springframework.beans.NotWritablePropertyException: Invalid property 'sessionFactory' of bean class [com.first.web.dao.LoginDaoImpl]: 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:1064)at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:924)at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:76)at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:58)at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1393)... 27 more
起初各种百度,有的说是Spring配置文件中扫描包配置出现的问题,有的说是把Spring配置文件中注入sessionFactory那句话去掉(可以尝试一下,去掉,然后用注释的方法注入SessionFactory),都试了试,发现是自己在dao层实现类中,SessionFactory的命名规范问题,写成了:
private SessionFactroy sf
没有与Spring配置文件中的名称保持一致。
总结:
1,注解时,必须配置好扫描包的设置,只有Spring扫描到了 类似@resource @component的时候才会去创建bean。
2,细心。
阅读全文
0 0
- 搭建框架遇到SessionFactory is not writable or has an invalid setter method的问题
- 错误信息:Bean property 'sessionFactory' is not writable or has an invalid setter method.
- 错误信息:Bean property 'sessionFactory' is not writable or has an invalid setter method.
- Bean property 'sessionFactory' is not writable or has an invalid setter method
- is not writable or has an invalid setter method错误
- quartz使用时遇到的问题Bean property 'xxx' is not writable or has an invalid setter method. Did you mean 'xxx
- resource required not found之Bean property 'sessionFactory' is not writable or has an invalid setter
- SSH框架 Bean property * is not writable or has an invalid setter method错误分析与解决方法
- Bean property 'loginDAO' is not writable or has an invalid setter method
- Bean property 'service' is not writable or has an invalid setter method. Did you mean 'serivce'?
- Bean property 'xxx' is not writable or has an invalid setter method
- Bean property 'annotatedClasses' is not writable or has an invalid setter method
- Bean property 'adminService' is not writable or has an invalid setter method
- 使用spring注入时出现is not writable or has an invalid setter method
- Spring整合Hibernate报错:annotatedClasses is not writable or has an invalid setter method
- Bean property XX' is not writable or has an invalid setter method
- spring中XML中Bean property 'dataSource' is not writable or has an invalid setter method.
- 使用spring注入时出现is not writable or has an invalid setter method
- 装饰模式
- 分布式唯一ID极简教程
- NTFS for Mac双十二持续发力 火热进行中
- 高效sql性能优化极简教程
- MySQL 优化百分比/比例计算
- 搭建框架遇到SessionFactory is not writable or has an invalid setter method的问题
- 广东问国笔,怎样才能消除疲劳?
- android之android.intent.category.DEFAULT的用途和使用
- iptables超全详解 http://www.linuxidc.com/Linux/2016-09/134832.htm
- 材料设计——折叠自定义toolbar
- Java之GC
- openstack compute service list报错(HTTP 503)
- shel基本知识-proc目录介绍
- 接口测试