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

Dan Allen dan.j.allen at gmail.com
Thu Sep 8 13:18:26 EDT 2011


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).

-Dan

-- 
Dan Allen
Principal Software Engineer, Red Hat | Author of Seam in Action
Registered Linux User #231597

http://www.google.com/profiles/dan.j.allen#about
http://mojavelinux.com
http://mojavelinux.com/seaminaction
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20110908/a8b21691/attachment.html 


More information about the cdi-dev mailing list