创建 ServletContext 资源 [/WEB-INF/spring/applicationContext.xml] 中定义的名为“editAction”的 bean 时出错,如果有人有时间修改全部

问题描述 投票:0回答:1

处理请求期间发生异常:无法实例化为名称空间“/”中的“formUpdate”定义的操作、editAction,在ServletContext资源[/WEB-INF/spring/applicationContext-edit.xml]中定义的名称为“editAction”的创建bean时出错:设置属性值时出错;嵌套异常是 org.springframework.beans.NotWritablePropertyException:bean 类 [org.apache.struts.edit.action.EditAction] 的无效属性“editService”:Bean 属性“editService”不可写或具有无效的 setter 方法。 setter 的参数类型与 getter 的返回类型是否匹配? com.opensymphony.xwork2.XWorkException:无法实例化为名称空间“/”中的“formUpdate”定义的操作、editAction,在ServletContext资源中定义的名为“editAction”的创建bean时出错[/WEB-INF/spring/applicationContext-edit.xml ]:设置属性值时出错;嵌套异常是 org.springframework.beans.NotWritablePropertyException:bean 类 [org.apache.struts.edit.action.EditAction] 的无效属性“editService”:Bean 属性“editService”不可写或具有无效的 setter 方法。 setter 的参数类型与 getter 的返回类型匹配吗?

创建 ServletContext 资源 [/WEB-INF/spring/applicationContext-edit.xml] 中定义的名为“editAction”的 bean 时出错:设置属性值时出错;嵌套异常是 org.springframework.beans.NotWritablePropertyException:bean 类 [org.apache.struts.edit.action.EditAction] 的无效属性“editService”:Bean 属性“editService”不可写或具有无效的 setter 方法。 setter 的参数类型与 getter 的返回类型匹配吗?

bean 类 [org.apache.struts.edit.action.EditAction] 的无效属性“editService”:Bean 属性“editService”不可写或具有无效的 setter 方法。 setter 的参数类型与 getter 的返回类型匹配吗?

spring model-view-controller struts2
1个回答
0
投票

bean 类 [org.apache.struts.edit.action.EditAction] 的无效属性“editService”:Bean 属性“editService”不可写或具有无效的 setter 方法。 setter 的参数类型与 getter 的返回类型匹配吗?

所以你需要为bean属性添加setter和getter

editService
。您可以手动执行或使用 Lombok 注释。例如

@Getter @Setter
private EditService editService;
© www.soinside.com 2019 - 2024. All rights reserved.