//Context of the bean
Context webbeansContext = getBeanManager().getContext(bean.getScope());
CreationalContextFactory contextFactory = bean.getWebBeansContext().getCreationalContextFactory();
if (webbeansContext instanceof AbstractContext)
{
AbstractContext owbContext = (AbstractContext)webbeansContext;
creationalContext = owbContext.getCreationalContext(contextual);
//No creational context means that no BeanInstanceBag
//Actually this can be occurs like scenarions
//@SessionScoped bean injected into @ApplicationScopedBean
//And session is destroyed and restarted but proxy still
//contained in @ApplicationScopedBean
if(creationalContext == null)
{
creationalContext = contextFactory.getCreationalContext(contextual);
owbContext.initContextualBag((OwbBean<Object>) bean, creationalContext);
}
}
// for 3rd party contexts (actually all contexts provided via portable extensions)
// we don't have all the stuff of AbstractContext available