[英]Spring AOP pointcut expression to exclude annotations
我正在嘗試創建一個切入點表達式,該表達式將觸發某個包中的所有方法,但不會基於自定義注釋觸發。 到目前為止,這是我第一次執行而不是第二次執行。 謝謝您的幫助!
@AfterThrowing(pointcut = "execution(* services..*.*(..)) && !within(@services.annotation.IgnoreBusinessServiceExceptionTranslation *)", throwing = "ex")
public void exceptionThrown( Throwable ex ){}
接口:
@Target(ElementType.METHOD)
@Retention(RetentionPolicy.RUNTIME)
public @interface IgnoreBusinessServiceExceptionTranslation
{}
找到了其他人的答案!
@AfterThrowing(pointcut = "execution(* services..*.*(..)) && !@annotation(services.annotation.IgnoreBusinessServiceExceptionTranslation)", throwing = "ex")
public void exceptionThrown( Throwable ex ){}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.