好久没来了。这些天一直在看夏昕的《Spring 开发指南》,遇到了一个问题没解决呢。
在Config.xml里有一段代码如下:
<bean id="LoginAction" class="net.xiaxin.action.LoginAction">
<property name="commandClass">
<value>net.xiaxin.action.LoginInfo</value>
</property>
<property name="fail_view">
<value>loginfail</value>
</property>
<property name="success_view">
<value>main</value>
</property>
</bean>
在net.xiaxin.action.LoginAction里设置了两个private String属性:fail_view和success_view,并且都提供了相应的setter方法。
运行时报错如下:
DispatcherServlet - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'LoginAction' defined in ServletContext resource [/WEB-INF/Config.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'commandClass' of bean class [net.xiaxin.action.LoginAction]: Bean property 'commandClass' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?
org.springframework.beans.NotWritablePropertyException: Invalid property 'commandClass' of bean class [net.xiaxin.action.LoginAction]: Bean property 'commandClass' is not writable or has an invalid setter method: Does the parameter type of the setter match the return type of the getter?
oh, my god.
Context initialization failed,
NotWritablePropertyException,
Invalid property 'commandClass' of bean class
Who can help me? SOS!