isBootstrapNeeded = false;
}
if (isBootstrapNeeded) {
CDI11Deployment deployment = createDeployment(context, bootstrap);
if (deployment.getBeanDeploymentArchives().isEmpty()) {
// Skip initialization - there is no bean archive in the deployment
CommonLogger.LOG.initSkippedNoBeanArchiveFound();
return false;
}
ResourceInjectionServices resourceInjectionServices = new ServletResourceInjectionServices() {
};
try {
for (BeanDeploymentArchive archive : deployment.getBeanDeploymentArchives()) {
archive.getServices().add(ResourceInjectionServices.class, resourceInjectionServices);
}
} catch (NoClassDefFoundError e) {
// Support GAE
WeldServletLogger.LOG.resourceInjectionNotAvailable();
}
String id = context.getInitParameter(CONTEXT_ID_KEY);
if (id != null) {
bootstrap.startContainer(id, Environments.SERVLET, deployment);
} else {
bootstrap.startContainer(Environments.SERVLET, deployment);
}
bootstrap.startInitialization();
/*
* This should work fine as all bean archives share the same classloader. The only difference this can make is per-BDA (CDI 1.0 style) enablement of
* alternatives, interceptors and decorators. Nothing we can do about that.
*/
manager = bootstrap.getManager(deployment.getBeanDeploymentArchives().iterator().next());
// Push the manager into the servlet context so we can access in JSF
context.setAttribute(BEAN_MANAGER_ATTRIBUTE_NAME, manager);
}