[cdi-dev] Should javax.enterprise.inject.Produces be inherited?

John Ament john.ament at spartasystems.com
Sun Sep 11 15:02:49 EDT 2016


All,


I was just thinking about alternatives and producer methods.  Suppose I have the following bean:


@ApplicationScoped
public class Boop {

    @Produces
    @ApplicationScoped
    public Simpler makeSimpler() {
        return new Simpler("Boop");
    }
}


If I want to override the producer method, I need to declare fully:


@Alternative
@Priority(100)
@ApplicationScoped
public class BoopAlternative extends Boop{
    @Override
    @Produces
    public Simpler makeSimpler() {
        return new Simpler("Boop2");
    }
}

For some reason, scopes are inherited, but the produces annotation is not.  At least in the case of a producer method, it seems like it would be useful for @Produces to be inherited as well.

John


________________________________
NOTICE: This e-mail message and any attachments may contain confidential, proprietary, and/or privileged information which should be treated accordingly. If you are not the intended recipient, please notify the sender immediately by return e-mail, delete this message, and destroy all physical and electronic copies. Thank you.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20160911/a3b4a45f/attachment.html 


More information about the cdi-dev mailing list