如何在非spring托管对象上注册spring应用程序中的方面
我有一个运行在JBoss中的spring mvc应用程序。我到处使用SpringAOP(使用注释);它们工作得很好。不过,我还想为几个JBoss类(特别是它们的登录JaaS类)创建一个方面 我在应用程序中创建了一个POJO,如下所示:如何在非spring托管对象上注册spring应用程序中的方面,spring,spring-mvc,aspectj,Spring,Spring Mvc,Aspectj,我有一个运行在JBoss中的spring mvc应用程序。我到处使用SpringAOP(使用注释);它们工作得很好。不过,我还想为几个JBoss类(特别是它们的登录JaaS类)创建一个方面 我在应用程序中创建了一个POJO,如下所示: package com.mycompany.aspect (all imports here) @Aspect public class MyAspect{ @Pointcut("execution(* org.jboss.plugins.*.login(
package com.mycompany.aspect
(all imports here)
@Aspect
public class MyAspect{
@Pointcut("execution(* org.jboss.plugins.*.login(..))"
private void myPointCut();
@Around("myPointCut()")
public Object doSomething(){....}
}
<aspectj>
<aspects>
<aspect name="com.mycompany.aspect.MyAspect"/>
</aspects>
<weaver>
<include within="org.jboss.plugins.*"/>
</weaver>
</aspectj>
我还在META-INF目录中创建了一个aop.xml文件,如下所示:
package com.mycompany.aspect
(all imports here)
@Aspect
public class MyAspect{
@Pointcut("execution(* org.jboss.plugins.*.login(..))"
private void myPointCut();
@Around("myPointCut()")
public Object doSomething(){....}
}
<aspectj>
<aspects>
<aspect name="com.mycompany.aspect.MyAspect"/>
</aspects>
<weaver>
<include within="org.jboss.plugins.*"/>
</weaver>
</aspectj>
当我的应用程序部署时,我得到以下RuntimeException:
。。。。。无法注册非方面com$mycompany$aspect$MyAspect,com.mycompany.aspect.MyAspect
我可能做错了什么
编辑:我应该提到我正在使用JBossAS(4.2)。。。这一点我无法改变:(