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 に答える