问题
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:
This is only possible with CDI stereotype annotations (see the interceptor bindings page for examples) in EE 6 (EJB 3.1).
来源:https://stackoverflow.com/questions/11326862/adding-ejb-interceptors-with-custom-annotations