Spring AOP方面在单独的模块中使用 [英] Spring AOP aspect used in a separate module

查看:362
本文介绍了Spring AOP方面在单独的模块中使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个maven项目模块中有一个方面com.x.NiceAspect,在一个单独的maven模块中有一个类com.x.NiceClass.这些模块具有相同的POM父级,一起创建了一个项目.

I have an aspect com.x.NiceAspect in one maven project module, and a class com.x.NiceClass in a separate maven module. Those modules have the same POM parent, together creating one project.

我要实现的目的是拥有一个通用的方面,可以将其包含在该项目的所有maven模块中.

The thing I am trying to achieve is to have a universal aspect that I can include in all my maven modules in this project.

现在NiceAspect中的切入点是 execution(* com.x .. .set (..)),这意味着我的软件包中的所有setter方法.

Now the pointcut in the NiceAspect is i.e. execution(* com.x...set(..)) meaning all setter methods in mine package.

我希望此方面与第二个模块一起运行,尤其是加入NiceClass

I want this aspect to run with the second module, especially to join NiceClass

我该如何实现?

此外,假设Aspect想要一个在第二个模块中定义的类的参数,那么我最终得到一个循环依赖项.

Moreover suppose that the Aspect wants an argument of a class that's defined in that second module, then I end up with a circular dependency..

任何帮助表示赞赏

亲切的问候,

x.

推荐答案

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆