On Sat, Apr 13, 2013 at 1:00 PM, José Luis Cetina <maxtorz...@gmail.com>wrote:
> When i dont want to use codi I use jndi lookup, it is to easy to use and > portable. I create a simple method for retrive my ejbs without using codi > instead i use jndi using only the name of the ejb class. > Recently, I added the following after listening in on that other/earlier topic/thread on myfaces or openejb list. The code below allowed me to remove CODI dependency. :) /* * http://docs.oracle.com/javaee/6/api/javax/enterprise/inject/spi/BeanManager.html * http://struberg.wordpress.com/2012/03/20/why-is-openwebbeans-so-fast/ */ @SuppressWarnings("unchecked") public <T> T getBean(Class<T> type) { Bean<T> bean = (Bean<T>) beanManager.resolve(beanManager.getBeans(type)); CreationalContext<T> creationalContext = beanManager.createCreationalContext(bean); return (T) beanManager.getReference(bean, type, creationalContext); }