[cdi-dev] Easier access to CDI outside of Java EE, easier access to instances

Pete Muir pmuir at redhat.com
Wed Sep 7 08:47:52 EDT 2011

This API offers quite a different view onto CDI than BeanManager, and from the comments we've received on CDI 1.0 [1] I believe it is an API that people are going to find more useful, leaving BeanManager for more "power" use cases. This was my reason to split it out, but I'm open to other suggestions?

On 7 Sep 2011, at 05:14, Lincoln Baxter wrote:

> Just wondering, if we have access to the BeanManager, why not just put select() on that?
> --
> Lincoln Baxter, III
> JBoss, by Red Hat
> lbaxter at redhat.com
> "If you want something, you'll find a way; if you don't, you'll find an excuse."
> ----- Original Message -----
> From: "Pete Muir" <pmuir at redhat.com>
> To: "CDI-Dev" <cdi-dev at lists.jboss.org>
> Sent: Tuesday, September 6, 2011 6:26:43 PM
> Subject: [cdi-dev] Easier access to CDI outside of Java EE,	easier access to instances
> Regarding https://issues.jboss.org/browse/CDI-14, I've created this patch https://github.com/jboss/cdi/pull/43.
> This also touches on CDI-26, which is about providing an embedded mode (API for starting CDI) - it covers about 50% of that issue. It doesn't provide a bootstrap API, but it does provide a programmatic API to access the container:
> CDI.current().getBeanManager();
> CDI.current().select(MyBean.class).select(new MyQualifierLiteral()).doSomething();
> (CDI implements Instance)
> I've copied the logic for looking up the current CDI instance from the JPA Persistence class.
> Please review, as I know this addresses two much sought after improvement, and I hope that the overall ethos of the approach I've taken you guys like. I suspect there are a couple of rough edges to iron out - specifically, I would like feedback on:
> * what happens when multiple CDI providers are located (right now as I straw man I followed JPA's example and returned the first one loaded, not sure if this right)
> * Classloading for the providers (Stuart has a comment here)
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev

More information about the cdi-dev mailing list