开发者社区> 问答> 正文

Spring配置问题 : 配置报错 


错误提示:org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dao' defined in class path resource [applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'sqlSessionFactory' of bean class [dao.impl.UserDaoImpl]: Bean property 'sqlSessionFactory' 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.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1396) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1118) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)

dao的实现:

展开
收起
kun坤 2020-06-03 14:41:03 676 0
1 条回答
写回答
取消 提交回答
  • 大神在哪儿呢######看你的配置文件应该是setter注入,你要确保你的UserDaoImpl里面有sqlSessionFactory属性和setSqlSessionFactory()方法######感谢感谢!终于好了 不容易呀咱看了半天的错误,百度了半天 谢谢您的回答######好的我马上试试

    2020-06-04 10:36:21
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
云栖社区特邀专家徐雷Java Spring Boot开发实战系列课程(第20讲):经典面试题与阿里等名企内部招聘求职面试技巧 立即下载
微服务架构模式与原理Spring Cloud开发实战 立即下载
阿里特邀专家徐雷Java Spring Boot开发实战系列课程(第18讲):制作Java Docker镜像与推送到DockerHub和阿里云Docker仓库 立即下载