use of org.apache.openejb.cdi.OptimizedLoaderService in project tomee by apache.
the class Assembler method ensureWebBeansContext.
private void ensureWebBeansContext(final AppContext appContext) {
WebBeansContext webBeansContext = appContext.get(WebBeansContext.class);
if (webBeansContext == null) {
webBeansContext = appContext.getWebBeansContext();
} else {
if (null == appContext.getWebBeansContext()) {
appContext.setWebBeansContext(webBeansContext);
}
return;
}
if (webBeansContext == null) {
final Map<Class<?>, Object> services = new HashMap<Class<?>, Object>();
services.put(JNDIService.class, new OpenEJBJndiService());
services.put(AppContext.class, appContext);
services.put(ScannerService.class, new CdiScanner());
services.put(BeanArchiveService.class, new OpenEJBBeanInfoService());
services.put(ELAdaptor.class, new CustomELAdapter(appContext));
services.put(LoaderService.class, new OptimizedLoaderService(appContext.getProperties()));
final Properties properties = new Properties();
properties.setProperty(org.apache.webbeans.spi.SecurityService.class.getName(), ManagedSecurityService.class.getName());
properties.setProperty(ContextsService.class.getName(), CdiAppContextsService.class.getName());
properties.setProperty(ResourceInjectionService.class.getName(), CdiResourceInjectionService.class.getName());
properties.setProperty(TransactionService.class.getName(), OpenEJBTransactionService.class.getName());
webBeansContext = new WebBeansContext(services, properties);
appContext.setCdiEnabled(false);
appContext.set(WebBeansContext.class, webBeansContext);
appContext.setWebBeansContext(webBeansContext);
}
}
Aggregations