码迷,mamicode.com
首页 > 其他好文 > 详细

j2EE编写时易错问题。

时间:2017-12-28 14:36:28      阅读:147      评论:0      收藏:0      [点我收藏+]

标签:spring中常见错

org.springframework.web.context.support.XmlWebApplicationContext.refresh Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'user_service' defined in class path resource [META-INF/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'recordDao' of bean class [com.jixiang.service.impl.UserServiceImpl]: Bean property 'recordDao' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?

28-Dec-2017 13:48:46.127 严重 [RMI TCP Connection(2)-127.0.0.1] org.springframework.web.context.ContextLoader.initWebApplicationContext Context initialization failed

 org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'user_service' defined in class path resource [META-INF/applicationContext.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'recordDao' of bean class [com.jixiang.service.impl.UserServiceImpl]: Bean property 'recordDao' 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:1568)

意思就是在com.jixiang.service.impl.UserServiceImpl这个类中没有找到recordDao,或者没有recordDao的setter方法。

但是你在Spring的applicationContext.xml配置中又加入了这个配置

<bean id="managerTemplate" abstract="true" lazy-init="true"
     
p:mangerDao-ref="managerDao"
     
p:userDao-ref="userDao"
   
 p:recordDao-ref="recordDao"
     
/>
<bean id="user_service"
     
class="com.jixiang.service.impl.UserServiceImpl"
     
parent="managerTemplate"/><!--class的类名一定要对-->


j2EE编写时易错问题。

标签:spring中常见错

原文地址:http://blog.51cto.com/ji123/2055491

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!