Say I have:
public interface Foo {...}
public class AltProducer {
private Foo altFoo;
@Produces @Alternative
public Foo getAltFoo() { return altFoo; }
}
What do I need to put in beans.xml so that my AltProducer's @Produces method will get called, instead of injecting Bar?
@Alternative
says:May be applied to a bean class, producer method or field
. But it is misleading, because inside beans.xml we can only specify<class>
or<stereotype>
- there is no way to enter producer method or field. – Ophiolatry