[cdi-dev] Alternative producer methods
    Mark Struberg 
    struberg at yahoo.de
       
    Sun Apr  1 09:51:05 EDT 2012
    
    
  
Dear EG colleagues!
I have a question about @Alternative on producer methods:
consider the following class:
// here is NO alternative annotation!
public class AlternativeOnProducerMethodOnlyBean {
   @Produces  @Alternative
   public IProducedBean generateBean2() {..}
}
So the class itself is NOT annotated as @Alternative
I'm not sure if 5.1.1 allows this or the other way around: if this must be supported.
Imo the important parts are (from 5.1.1)
> Each child <class> element must specify the name of an alternative bean class. 
> If there is no class with the specified name, or if the class with the specified 
> name is not an alternative bean class, the container automatically detects 
> the problem and treats it as a deployment problem.
The question is now how 'an alternative bean class' is to be interpreted ^^
The first paragraph of 5.1.1 says:
>  An alternative is selected for the bean archive if either ...
> * the alternative is a producer method, field or resource, and the 
> bean class that declares the method or field is listed, ...
But does this qualify the AlternativeOnProducerMethodOnlyBean as 'alternative bean class'?
Any ideas?
Btw: the whole topic of disposal methods for @Alternative producers are completely unspecified...
LieGrue,
strub
    
    
More information about the cdi-dev
mailing list