Adding EJB interceptors with custom annotations

2019-09-15 20:01发布

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.

1条回答
再贱就再见
2楼-- · 2019-09-15 20:20

This is only possible with CDI stereotype annotations (see the interceptor bindings page for examples) in EE 6 (EJB 3.1).

查看更多
登录 后发表回答