07 Dezember 2011

OpenWebBeans Bootstrap in Java SE

It took me a while to get OpenWebBeans in Java SE up and running. Find below an example on how to bootstrap OWB:

ContainerLifecycle lifecycle = WebBeansContext.currentInstance().getService(ContainerLifecycle.class);

BeanManager beanManager = lifecycle.getBeanManager();
Bean<?> bean = beanManager.getBeans(B.class).iterator().next();

B b = (B) lifecycle.getBeanManager().getReference(bean, B.class, beanManager.createCreationalContext(bean));

1 Kommentar:

Classified ad software hat gesagt…

Wow, great article, I really appreciate your thought process and having it explained properly, thank you!

Classified Software