标签: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的类名一定要对-->
。
标签:spring中常见错
原文地址:http://blog.51cto.com/ji123/2055491