Package javax.enterprise.inject.spi

Examples of javax.enterprise.inject.spi.BeanManager.resolve()


    public void ensureNoThreadLocalLeakOnContexts() throws Exception {
        TestContainer container = new TestContainer(Foo.class, ThreadLocalTestCase.class);
        container.startContainer();
        BeanManager manager = getBeanManager(container);

        Bean<? extends Object> testBean = manager.resolve(manager.getBeans(ThreadLocalTestCase.class));

        try {
            manager.getReference(
                    testBean,
                    ThreadLocalTestCase.class,
View Full Code Here


    public void ensureNoThreadLocalLeakOnInjectionPoints() throws Exception {
        TestContainer container = new TestContainer(Bar.class, Baz.class);
        container.startContainer();
        BeanManager manager = getBeanManager(container);

        Bean<?> testBean = manager.resolve(manager.getBeans(Baz.class));

        Baz baz = cast(manager.getReference(
                testBean,
                Baz.class,
                manager.createCreationalContext(testBean)));
View Full Code Here

    @Test
    public void testAllBeanDiscoveryAlternative(Cat representative) {
        BeanManager bm = representative.getBeanManager();
        Set<Bean<?>> beans = bm.getBeans(DogInterface.class);
        assertEquals(2, beans.size());
        assertEquals(AlternativeDog.class, bm.resolve(beans).getBeanClass());
    }

    @Test
    public void testAnnotatedBeanDiscoveryAlternative(Plant representative) {
        BeanManager bm = representative.getBeanManager();
View Full Code Here

    @Test
    public void testAnnotatedBeanDiscoveryAlternative(Plant representative) {
        BeanManager bm = representative.getBeanManager();
        Set<Bean<?>> treeBeans = bm.getBeans(Tree.class);
        assertEquals(2, treeBeans.size());
        assertEquals(AlternativeTree.class, bm.resolve(treeBeans).getBeanClass());

        Set<Bean<?>> stoneBeans = bm.getBeans(Stone.class);
        assertEquals(0, stoneBeans.size());
    }
View Full Code Here

  }
 
  private void audit(Account account)
  {
    BeanManager bm = getBeanManager();
    Bean<?> beans = bm.resolve(bm.getBeans(AccountAudit.class));
    AccountAudit accountAudit = (AccountAudit) bm.getReference(beans, AccountAudit.class, bm.createCreationalContext(beans))
    accountAudit.audit(account);
  }
 
}
View Full Code Here

                        if (webBeansContext == null) {
                            return null; // too early to have a cdi bean, skip these methods - mainly init() but @PostConstruct works then
                        }
                        final BeanManager bm = webBeansContext.getBeanManagerImpl();
                        final Set<Bean<?>> beans = bm.getBeans(clazz);
                        final Bean<?> bean = bm.resolve(beans);
                        if (bean == null) {
                            return null;
                        }
                        creationalContext = bm.createCreationalContext(null);
                        instance = bm.getReference(bean, clazz, creationalContext);
View Full Code Here

                bm = null;
                bean = null;
            } else {
                bm = wc.getBeanManagerImpl();
                final Set<Bean<?>> beans = bm.getBeans(clazz);
                bean = bm.resolve(beans);
            }

            // create the MBean instance with cdi if possible or manually otherwise
            final Object instance;
            final CreationalContext creationalContext;
View Full Code Here

                    }
                }
                beans = modifiableBeans;
            }

            Bean<?> bean = beanManager.resolve( beans );

            CreationalContext<?> creationContext = beanManager.createCreationalContext( bean );
            this.bean = beanManager.getReference( bean, type, creationContext );
        } finally {
            Thread.currentThread().setContextClassLoader( originalCl );
View Full Code Here

                            throw new TomEERuntimeException(e);
                        }
                    } else {
                        final BeanManager bm = WebBeansContext.currentInstance().getBeanManagerImpl();
                        final Set<Bean<?>> beans = bm.getBeans(clazz);
                        final Bean<?> bean = bm.resolve(beans);
                        creationalContext = bm.createCreationalContext(null);
                        instance = bm.getReference(bean, clazz, creationalContext);
                    }

                    if (instance == null) {
View Full Code Here

                bm = null;
                bean = null;
            } else {
                bm = wc.getBeanManagerImpl();
                final Set<Bean<?>> beans = bm.getBeans(clazz);
                bean = bm.resolve(beans);
            }

            // create the MBean instance with cdi if possible or manually otherwise
            final Object instance;
            final CreationalContext creationalContext;
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.