问题
Is it possible to make pointcut using Spring AOP for methods and type having annotation which was annotated with some annotation. Here's my custom annotation:
@AccessRestriction
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface HasPermission {
}
It annotated with this annotation:
@Target({ElementType.ANNOTATION_TYPE})
@Retention(RetentionPolicy.RUNTIME)
public @interface AccessRestriction {
}
So is it possible to create point cut which will handle all methods which are annotated with any annotation annotated with AccessRestriction.
回答1:
I found solution.
I made such pointcut:
within(@(@test.security.access.AccessRestriction *) *) ||
execution(@(@test.security.access.AccessRestriction *) * *(..))
来源:https://stackoverflow.com/questions/37806731/aspect-for-method-annotated-with-annotation-which-are-annotated-with-another-ann