use of javax.enterprise.inject.spi.BeanManager in project camel by apache.
the class CdiCamelExtension method beans.
private void beans(@Observes ProcessBean<?> pb, BeanManager manager) {
cdiBeans.add(pb.getBean());
// Lookup for CDI event endpoint injection points
pb.getBean().getInjectionPoints().stream().filter(ip -> CdiEventEndpoint.class.equals(getRawType(ip.getType()))).forEach(ip -> {
Type type = ip.getType() instanceof ParameterizedType ? ((ParameterizedType) ip.getType()).getActualTypeArguments()[0] : Object.class;
String uri = eventEndpointUri(type, ip.getQualifiers());
cdiEventEndpoints.put(uri, new CdiEventEndpoint<>(uri, type, ip.getQualifiers(), manager));
});
}
use of javax.enterprise.inject.spi.BeanManager in project camel by apache.
the class Main method warnIfNoCamelFound.
private void warnIfNoCamelFound() {
BeanManager manager = cdiContainer.getBeanManager();
Set<Bean<?>> contexts = manager.getBeans(CamelContext.class, ANY);
// Warn if there is no CDI Camel contexts
if (contexts.isEmpty()) {
LOG.warn("Camel CDI main has started with no Camel context!");
}
}
use of javax.enterprise.inject.spi.BeanManager in project Activiti by Activiti.
the class CdiResolver method getWrappedResolver.
protected javax.el.ELResolver getWrappedResolver() {
BeanManager beanManager = getBeanManager();
javax.el.ELResolver resolver = beanManager.getELResolver();
return resolver;
}
use of javax.enterprise.inject.spi.BeanManager in project aries by apache.
the class CdiContainerTests method testGetBeanFromCdiContainerService.
public void testGetBeanFromCdiContainerService() throws Exception {
BeanManager beanManager = cdiContainer.getBeanManager();
assertNotNull(beanManager);
assertPojoExists(beanManager);
}
use of javax.enterprise.inject.spi.BeanManager in project aries by apache.
the class CdiContainerTests method testGetBeanManagerFromCDI.
public void testGetBeanManagerFromCDI() throws Exception {
Thread currentThread = Thread.currentThread();
ClassLoader contextClassLoader = currentThread.getContextClassLoader();
try {
BundleWiring bundleWiring = cdiBundle.adapt(BundleWiring.class);
currentThread.setContextClassLoader(bundleWiring.getClassLoader());
BeanManager beanManager = CDI.current().getBeanManager();
assertNotNull(beanManager);
assertPojoExists(beanManager);
} finally {
currentThread.setContextClassLoader(contextClassLoader);
}
}
Aggregations