使用自定义注释添加EJB拦截器 [英] Adding EJB interceptors with custom annotations
问题描述
@Interceptors({MyInterceptor.class})
添加拦截器,然后添加了一个第二个自定义注释,如 @MyInterceptorConfiguration( value = something)
。 虽然这很麻烦,是否可以注释自定义注释,以便它会触发添加拦截器?理想情况下,我想将 @DoMyInterception(config = foo)
添加到一个类中,并添加我的拦截器。
只有CDI 原型注释(请参阅拦截器绑定页面的例子)在EE 6(EJB 3.1)中。
I have a number of EJB3.0 interceptors that require additional configuration. So far I have been simply adding the interceptors via @Interceptors( { MyInterceptor.class } )
and then added a second, custom annotation like @MyInterceptorConfiguration(value=something)
.
This is rather tedious though. Is it possible to annotate a custom annotation so that it will trigger the addition of an Interceptor? Ideally I would like to just add @DoMyInterception(config=foo)
to a class and have that add my interceptor.
This is only possible with CDI stereotype annotations (see the interceptor bindings page for examples) in EE 6 (EJB 3.1).
这篇关于使用自定义注释添加EJB拦截器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!