当前位置: 首页>>代码示例>>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;未经允许,请勿转载。