當前位置: 首頁>>代碼示例>>Java>>正文


Java AfterBeanDiscovery.addContext方法代碼示例

本文整理匯總了Java中javax.enterprise.inject.spi.AfterBeanDiscovery.addContext方法的典型用法代碼示例。如果您正苦於以下問題:Java AfterBeanDiscovery.addContext方法的具體用法?Java AfterBeanDiscovery.addContext怎麽用?Java AfterBeanDiscovery.addContext使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在javax.enterprise.inject.spi.AfterBeanDiscovery的用法示例。


在下文中一共展示了AfterBeanDiscovery.addContext方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: afterBeanDiscovery

import javax.enterprise.inject.spi.AfterBeanDiscovery; //導入方法依賴的package包/類
void afterBeanDiscovery(@Observes AfterBeanDiscovery event, BeanManager beanManager) {

        final CommandContextImpl commandContext = new CommandContextImpl();

        // Register the command context
        event.addContext(commandContext);

        // Register the command context bean using CDI 2 configurators API
        event.addBean()
            .addType(CommandContext.class)
            .createWith(ctx -> new InjectableCommandContext(commandContext, beanManager))
            .addQualifier(Default.Literal.INSTANCE)
            .scope(Dependent.class)
            .beanClass(CommandExtension.class);

        // Register the CommandExecution bean using CDI 2 configurators API
        event.addBean()
            .createWith(ctx -> commandContext.getCurrentCommandExecution())
            .addType(CommandExecution.class)
            .addQualifier(Default.Literal.INSTANCE)
            .scope(CommandScoped.class)
            .beanClass(CommandExtension.class);
    }
 
開發者ID:weld,項目名稱:command-context-example,代碼行數:24,代碼來源:CommandExtension.java

示例2: afterBeandiscovery

import javax.enterprise.inject.spi.AfterBeanDiscovery; //導入方法依賴的package包/類
void afterBeandiscovery(@Observes AfterBeanDiscovery event) {
    if (scopesToActivate != null) {
        for (Class<? extends Annotation> scope : scopesToActivate) {
            ContextImpl ctx = new ContextImpl(scope);
            contexts.add(ctx);
            event.addContext(ctx);
        }
    }
    if (beans != null) {
        for (Bean<?> bean : beans) {
            event.addBean(bean);
        }
    }
}
 
開發者ID:weld,項目名稱:weld-junit,代碼行數:15,代碼來源:WeldCDIExtension.java

示例3: afterBeanDiscovery

import javax.enterprise.inject.spi.AfterBeanDiscovery; //導入方法依賴的package包/類
public void afterBeanDiscovery(@Observes AfterBeanDiscovery abd,
                               BeanManager beanManager) {
    if (logger.isDebugEnabled()) {
        logger.debug("After bean discovery, adding WorkspaceScopeContext");
    }

    abd.addContext(new WorkspaceScopeContext(beanManager));
}
 
開發者ID:kiegroup,項目名稱:appformer,代碼行數:9,代碼來源:WorkspaceScopedExtension.java

示例4: afterBeanDiscovery

import javax.enterprise.inject.spi.AfterBeanDiscovery; //導入方法依賴的package包/類
/**
 * Handling of the after bean discovery event as fired by the bean manager. The handling creates
 * contexts for the session and request scopes.
 * 
 * @param event The event that can be used for the actions
 */
public void afterBeanDiscovery(@Observes AfterBeanDiscovery event) {
    // Register the session scope context.
    event.addContext(registerContext(addContext(new MultiInstanceContext(SessionScoped.class, null))));
    // And the request scope context.
    event.addContext(registerContext(addContext(new MultiInstanceContext(RequestScoped.class, null))));
    // And the bundle scope.
    event.addContext(addContext(new BasicContext(ComponentScoped.class, null)));
    // And the view scope.
    event.addContext(registerContext(addContext(new MultiInstanceContext(ViewScoped.class, null))));
}
 
開發者ID:arievanwi,項目名稱:osgi.ee,代碼行數:17,代碼來源:ScopeExtension.java

示例5: addPortletCustomScopeContexts

import javax.enterprise.inject.spi.AfterBeanDiscovery; //導入方法依賴的package包/類
/**
 * Add the context for the custom scope implementations.
 * 
 * @param abd
 */
void addPortletCustomScopeContexts(@Observes AfterBeanDiscovery abd) {
   PortletSessionScopedContext pssc = new PortletSessionScopedContext();
   abd.addContext(pssc);
   
   PortletStateScopedContext pstsc = new PortletStateScopedContext();
   abd.addContext(pstsc);
   
   PortletRequestScopedContext prsc = new PortletRequestScopedContext();
   abd.addContext(prsc);
}
 
開發者ID:apache,項目名稱:portals-pluto,代碼行數:16,代碼來源:PortletCDIExtension.java

示例6: afterBeanDiscovery

import javax.enterprise.inject.spi.AfterBeanDiscovery; //導入方法依賴的package包/類
public void afterBeanDiscovery(@Observes AfterBeanDiscovery event, BeanManager manager) {
    BeanStore beanStore = new HashMapBeanStore();
    final CustomContext customContext = new CustomContext();
    customContext.setBeanStore(beanStore);

    customContext.setActive(true);
    event.addContext(customContext);
    CUSTOM_CONTEXT = customContext;
}
 
開發者ID:bpark,項目名稱:weld-se-scopes,代碼行數:10,代碼來源:CustomScopeExtension.java

示例7: afterBeanDiscovered

import javax.enterprise.inject.spi.AfterBeanDiscovery; //導入方法依賴的package包/類
/**
 * Observes {@link AfterBeanDiscovery} event.
 *
 * @param event {@link AfterBeanDiscovery} event.
 * @param beanManager {@link BeanManager}.
 */
void afterBeanDiscovered(
    @Observes AfterBeanDiscovery event,
    BeanManager beanManager)
{
    event.addContext(new TransactionalContext(beanManager));
}
 
開發者ID:arkhipov,項目名稱:transaction-cdi,代碼行數:13,代碼來源:TransactionExtension.java

示例8: addBatchScopes

import javax.enterprise.inject.spi.AfterBeanDiscovery; //導入方法依賴的package包/類
void addBatchScopes(final @Observes AfterBeanDiscovery afterBeanDiscovery, final BeanManager bm) {
    jobContext = new JobContextImpl(bm);
    stepContext = new StepContextImpl(bm);

    afterBeanDiscovery.addContext(jobContext);
    afterBeanDiscovery.addContext(stepContext);
}
 
開發者ID:apache,項目名稱:incubator-batchee,代碼行數:8,代碼來源:BatchEEScopeExtension.java

示例9: registerTransactionContext

import javax.enterprise.inject.spi.AfterBeanDiscovery; //導入方法依賴的package包/類
/**
 * Register the TransactionContext as a CDI Context
 *
 * @param afterBeanDiscovery after-bean-discovery event
 */
protected void registerTransactionContext(@Observes AfterBeanDiscovery afterBeanDiscovery)
{
    if (!isActivated)
    {
        return;
    }

    TransactionContext transactionContext = new TransactionContext();
    afterBeanDiscovery.addContext(transactionContext);
}
 
開發者ID:apache,項目名稱:deltaspike,代碼行數:16,代碼來源:TransactionContextExtension.java

示例10: registerViewContext

import javax.enterprise.inject.spi.AfterBeanDiscovery; //導入方法依賴的package包/類
/**
 * Register and start the ViewScopedContext.
 */
public void registerViewContext(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager)
{
    if (!isActivated)
    {
        return;
    }

    //X TODO check whether we still need this in EE6: CodiStartupBroadcaster.broadcastStartup();
    
    afterBeanDiscovery.addContext(new ViewScopedContext(beanManager));
}
 
開發者ID:apache,項目名稱:deltaspike,代碼行數:15,代碼來源:ViewScopedExtension.java

示例11: registerDeltaSpikeContexts

import javax.enterprise.inject.spi.AfterBeanDiscovery; //導入方法依賴的package包/類
public void registerDeltaSpikeContexts(@Observes AfterBeanDiscovery afterBeanDiscovery, BeanManager beanManager)
{
    if (!isActivated)
    {
        return;
    }

    windowContext = new WindowContextImpl(beanManager);
    conversationContext = new GroupedConversationContext(beanManager, windowContext);
    viewAccessScopedContext = new ViewAccessContext(beanManager, windowContext);
    afterBeanDiscovery.addContext(windowContext);
    afterBeanDiscovery.addContext(conversationContext);
    afterBeanDiscovery.addContext(viewAccessScopedContext);
}
 
開發者ID:apache,項目名稱:deltaspike,代碼行數:15,代碼來源:DeltaSpikeContextExtension.java

示例12: afterBeanDiscovered

import javax.enterprise.inject.spi.AfterBeanDiscovery; //導入方法依賴的package包/類
void afterBeanDiscovered(@Observes AfterBeanDiscovery event, BeanManager beanManager) {
    event.addContext(new TransactionalContext(beanManager));
}
 
開發者ID:apache,項目名稱:aries-jpa,代碼行數:4,代碼來源:TransactionExtension.java

示例13: afterBeanDiscovery

import javax.enterprise.inject.spi.AfterBeanDiscovery; //導入方法依賴的package包/類
public void afterBeanDiscovery(@Observes AfterBeanDiscovery event, BeanManager manager) {
    BeanManagerLookup.localInstance = manager;
    event.addContext(new BusinessProcessContext(manager));
}
 
開發者ID:flowable,項目名稱:flowable-engine,代碼行數:5,代碼來源:FlowableExtension.java

示例14: registerACustomScopeContext

import javax.enterprise.inject.spi.AfterBeanDiscovery; //導入方法依賴的package包/類
public void registerACustomScopeContext(@Observes final AfterBeanDiscovery event) {
    event.addContext(new BusinessScopeContext());
}
 
開發者ID:Salaboy,項目名稱:drools-workshop,代碼行數:4,代碼來源:BusinessScopeExtension.java

示例15: registerContext

import javax.enterprise.inject.spi.AfterBeanDiscovery; //導入方法依賴的package包/類
public void registerContext(@Observes final AfterBeanDiscovery event) {
	event.addContext(new ViewScopedContext());
}
 
開發者ID:fabiohxcx,項目名稱:PedidoVenda,代碼行數:4,代碼來源:ViewContextExtension.java


注:本文中的javax.enterprise.inject.spi.AfterBeanDiscovery.addContext方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。