[cdi-dev] [JBoss JIRA] (CDI-26) Bootstrap API for CDI

Jozef Hartinger (JIRA) issues at jboss.org
Tue Mar 17 05:56:22 EDT 2015


    [ https://issues.jboss.org/browse/CDI-26?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13050840#comment-13050840 ] 

Jozef Hartinger commented on CDI-26:
------------------------------------

An alternative proposal that does not prevent parallel container instances:

{code:java}
public abstract class ControlledCDI<T> extends CDI<T> implements AutoCloseable {

    public static ControlledCDI<Object> initialize() {
        // TODO: Use CDIProvider internally to talk to the impl
    }

    public static ControlledCDI<Object> initialize(Map<String, Object> properties) {
        // TODO: Use CDIProvider internally to talk to the impl
    }

    public abstract void close();
}
{code}

Usage:

{code:java}
        try (ControlledCDI<Object> cdi = ControlledCDI.initialize()) {
            Foo foo = cdi.select(Foo.class).get();
            System.out.println(foo.computeResult());
        }
{code}

Note that this is a preliminary proposal. The class name is subject to change plus we'll most likely need a builder API instead of the static methods in the end.

> Bootstrap API for CDI
> ---------------------
>
>                 Key: CDI-26
>                 URL: https://issues.jboss.org/browse/CDI-26
>             Project: CDI Specification Issues
>          Issue Type: Feature Request
>          Components: Packaging and Deployment
>    Affects Versions: 1.0, 1.1.PFD, 1.2.Final
>            Reporter: Pete Muir
>             Fix For: 2.0 (discussion)
>
>
> Weld and other CDI impls allow an embedded mode.
> See http://docs.jboss.org/weld/reference/latest/en-US/html/environments.html#d0e5417 for example



--
This message was sent by Atlassian JIRA
(v6.3.11#6341)


More information about the cdi-dev mailing list