We're migrating an EJB 3.0 application to EJB 3.1 and would like to use @Stereotype
to reduce some of the EJB configuration.
The annotations we plan to have are:
- @Singleton
- @ConcurrencyManagement(BEAN)
- @PermitAll
- @Interceptors or custom @InterceptorBinding annotation
- @SecurityDomain("acme") JBoss / PicketLink
Of those I know that @Singleton
can't be put into a @Stereotype
and has to be on the EJB itself. What else can't be put into a @Stereotype
?
Update
The specification [1], [2] says that
A stereotype encapsulates any combination of:
- default scope, and
- a set of interceptor bindings.
The examples then use Java EE 7 @Transactional
which is an @InterceptorBinding
which leads me to believe that none of the above annotations can be put into a stereotype.
The The Java EE 6 Tutorial states the following:
So as you saw yourself, the annotations you used are not in one of the mentioned groups.
My personal suggestion is, to be careful with creating and using stereotypes, since one then always have to know (or check) what it means, so for example I prefer using
@Named @RequestScoped
rather than@Model
because saving one line of code does not make up to not see the scope at the first glance.