Search in sources :

Example 1 with ThreadContext

use of org.jboss.weld.environment.se.contexts.ThreadContext in project core by weld.

the class WeldSEBeanRegistrant method registerWeldSEContexts.

public void registerWeldSEContexts(@Observes AfterBeanDiscovery event, BeanManager manager) {
    if (ignoreEvent(event)) {
        return;
    }
    final String contextId = BeanManagerProxy.unwrap(manager).getContextId();
    this.threadContext = new ThreadContext(contextId);
    event.addContext(threadContext);
    // Register WeldContainer as a singleton
    event.addBean().addType(WeldContainer.class).addQualifier(Default.Literal.INSTANCE).scope(Singleton.class).produceWith((i) -> WeldContainer.instance(contextId));
}
Also used : Singleton(jakarta.inject.Singleton) ThreadContext(org.jboss.weld.environment.se.contexts.ThreadContext)

Aggregations

Singleton (jakarta.inject.Singleton)1 ThreadContext (org.jboss.weld.environment.se.contexts.ThreadContext)1