Java 拦截器,对@InterceptorBinding 感到困惑

Java interceptors, confused about @InterceptorBinding

我正在玩拦截器和注释,但我很困惑,找不到详尽的教程。 其实我不明白这之间的区别:

@Inherited
@InterceptorBinding
@Target({TYPE, METHOD})
@Retention(RUNTIME)
public @interface MyCustomAnnotation {}

还有这个:

@Inherited
@Target({TYPE, METHOD})
@Retention(RUNTIME)
public @interface MyCustomAnnotation {}

@InterceptorBinding 是做什么的?为什么使用它,为什么不使用它?

我正在搜索一些关于注释和拦截器示例的良好操作方法,涵盖不同的用例,但我找到了有关非常基本用法或一些神秘代码(至少对我而言)的文档,但没有任何解释,所以谢谢你,如果你能给我一些指导。

考虑拦截器声明:

@Inherited
@InterceptorBinding
@Retention(RUNTIME)
@Target({METHOD, TYPE})
public @interface Logged {
}

@InterceptorBinding只是一个指示器,用于将注解绑定到特定的拦截器。

Along with an interceptor, an application defines one or more interceptor binding types, which are annotations that associate an interceptor with target beans or methods. For example, the billpayment example contains an interceptor binding type named @Logged and an interceptor named LoggedInterceptor.

@Inherited 用于允许此注释向下 class 层次结构。

An interceptor binding also has the java.lang.annotation.Inherited annotation, to specify that the annotation can be inherited from superclasses. The @Inherited annotation also applies to custom scopes (not discussed in this tutorial), but does not apply to qualifiers.

也看看documentation