我已经将Struts 2与Spring 3集成在一起工作正常。我使用自定义ObjectFactory从Spring上下文中获取Action实例。现在我已经实现了AOP,
@Pointcut("target(com.motherframework.frontendplugin.struts2.action.BaseAction)")
BaseAction是抽象类。我还为Service层定义了一些其他切入点。但是,当服务器启动时,我收到一个错误,
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" />
请帮助!!
答案 0 :(得分:0)
使用JDK代理实现AOP时,代理类必须没有args构造函数。 将以下代码添加到CustomAction
public CustomAction(){}