0

我已经将 Struts 2 与 Spring 3 集成在一起,运行良好。我已经使用我的自定义 ObjectFactory 从 Spring 上下文中获取 Action 实例。现在我已经实现了 AOP,例如,

@Pointcut("target(com.motherframework.frontendplugin.struts2.action.BaseAction)")

BaseAction 是抽象类。我还为服务层定义了一些其他切入点。但是在服务器启动时,我遇到了一个错误,例如,

DEBUG JdkDynamicAopProxy:113 - Creating JDK dynamic proxy: target source is    SingletonTargetSource for target object [com.motherframework.application.school.action.security.CustomAction@c11557]
DEBUG DefaultListableBeanFactory:452 - Finished creating instance of bean 'customAction'
Sep 30, 2012 4:20:11 PM org.apache.catalina.core.StandardContext filterStart
SEVERE: Exception starting filter struts2
Unable to load configuration. - action - file:<file-path>/EPMS/WEB-INF/classes/struts-security.xml:6:80

...
Caused by: Action class [customAction] does not have a public no-arg constructor

下面是我的 strts.xml

<action name="restrictUser" class="customAction" method="restrictUser" />

请帮忙!!

4

1 回答 1

0

使用 JDK Proxy 实现 AOP 时,代理类必须没有 args 构造函数。将以下代码添加到 CustomAction

public CustomAction(){}
于 2013-06-26T09:11:15.397 回答