您的位置:首页 > 编程语言 > Java开发

最近在看夏昕的《Spring 开发指南》,在spring配置config.xml里设置commandClass参数的问题...

2006-11-20 16:42 429 查看

好久没来了。这些天一直在看夏昕的《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!
 

阅读更多
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐