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

Java拦截器,对@InterceptorBinding感到困惑,java,annotations,interceptor,Java,Annotations,Interceptor,我正在玩截取器和注释,但我很困惑,找不到详细的教程。 实际上我不明白这两者之间的区别: @Inherited @InterceptorBinding @Target({TYPE, METHOD}) @Retention(RUNTIME) public @interface MyCustomAnnotation {} 这是: @Inherited @Target({TYPE, METHOD}) @Retention(RUNTIME) public @interface MyCustomAnnot

我正在玩截取器和注释,但我很困惑,找不到详细的教程。 实际上我不明白这两者之间的区别:

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

@Inherited
@Target({TYPE, METHOD})
@Retention(RUNTIME)
public @interface MyCustomAnnotation {}
@InterceptorBinding做什么?为什么使用它,为什么不使用


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

考虑拦截器声明:

@Inherited
@InterceptorBinding
@Retention(RUNTIME)
@Target({METHOD, TYPE})
public @interface Logged {
}
@InterceptorBinding只是一个用于将注释绑定到特定拦截器的指示符

与拦截器一起,应用程序定义一个或多个拦截器绑定类型,这些类型是将拦截器与目标bean或方法关联的注释。例如,billpayment示例包含名为@Logged的拦截器绑定类型和名为LoggedInterceptor的拦截器

@Inherited用于允许按类层次结构向下进行此注释

拦截器绑定还具有java.lang.annotation.Inherited注释,以指定可以从超类继承注释。@Inherited注释也适用于自定义范围(本教程中未讨论),但不适用于限定符

也来看看