本文整理汇总了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);
}
示例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);
}
}
}
示例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));
}
示例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))));
}
示例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);
}
示例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;
}
示例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));
}
示例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);
}
示例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);
}
示例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));
}
示例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);
}
示例12: afterBeanDiscovered
import javax.enterprise.inject.spi.AfterBeanDiscovery; //导入方法依赖的package包/类
void afterBeanDiscovered(@Observes AfterBeanDiscovery event, BeanManager beanManager) {
event.addContext(new TransactionalContext(beanManager));
}
示例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));
}
示例14: registerACustomScopeContext
import javax.enterprise.inject.spi.AfterBeanDiscovery; //导入方法依赖的package包/类
public void registerACustomScopeContext(@Observes final AfterBeanDiscovery event) {
event.addContext(new BusinessScopeContext());
}
示例15: registerContext
import javax.enterprise.inject.spi.AfterBeanDiscovery; //导入方法依赖的package包/类
public void registerContext(@Observes final AfterBeanDiscovery event) {
event.addContext(new ViewScopedContext());
}