myfaces-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Howard W. Smith, Jr." <smithh032...@gmail.com>
Subject Re: @Singleton @Lock(READ) to resolve, Could not instantiate converter ...
Date Sat, 13 Apr 2013 17:04:32 GMT
On Sat, Apr 13, 2013 at 1:00 PM, José Luis Cetina <maxtorzito@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);
    }

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message