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

Pete Muir pmuir at redhat.com
Thu Sep 8 15:13:06 EDT 2011


On 8 Sep 2011, at 13:18, Dan Allen wrote:

> On Tue, Sep 6, 2011 at 18:26, Pete Muir <pmuir at redhat.com> wrote:
> 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 like the approach. The name of the current() method doesn't feel quite right. What about:
> 
> CDI.getRuntime()
> 
> (this was also suggested by Laird Neslon).

Runtime isn't the right word, as we don't describe CDI ever as a runtime. Container would be more appropriate, but there may be issues around this.

Linda, any comments from a Java EE perspective?


More information about the cdi-dev mailing list