sách gpt4 ai đã đi

java - 在没有 Spring 的情况下在 aop.xml 中组合 AOP 切入点

In lại 作者:行者123 更新时间:2023-11-30 11:50:48 28 4
mua khóa gpt4 Nike

下面是我要创建的方面。我想将两个切入点表达式合并为一个。我已经看到这可以使用带注释的切入点来完成,但是 xml 中的相同语法失败了。谁能帮帮我?



extends="com.logger.aspect.InjectionLogger">

expression="execution(* com.*..*.next(..)) || execution(* com.*..*.read(..))"/>



Cảm ơn trước

1 Câu trả lời

在 xml 中使用 Spring 2.0.x 是不可能的:

XML style is more limited in what in can express than the @AspectJ style: only the "singleton" aspect instantiation model is supported, and it is not possible to combine named pointcuts declared in XML

6.4.2. @AspectJ or XML for Spring AOP

但是在 Spring 3.0.x 中是可能的:

When combining pointcut sub-expressions, '&&' is awkward within an XML document, and so the keywords 'and', 'or' and 'not' can be used in place of '&&', '||' and '!' respectively. For example, the previous pointcut may be better written as:





expression="execution(* com.xyz.myapp.service.*.*(..)) and this(service)"/>

...



Spring 3 aop

关于java - 在没有 Spring 的情况下在 aop.xml 中组合 AOP 切入点,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7756690/

28 4 0
行者123
Hồ sơ cá nhân

Tôi là một lập trình viên xuất sắc, rất giỏi!

Nhận phiếu giảm giá Didi Taxi miễn phí
Mã giảm giá Didi Taxi
Giấy chứng nhận ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com