Package javax.enterprise.inject.spi

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


                BeanProvider.injectFields(this.originalTarget); //fallback to simple injection
                invokeMethod(this.originalTarget);
            }
            else
            {
                Bean<Object> bean = (Bean<Object>) beanManager.resolve(beans);

                CreationalContext<Object> creationalContext = beanManager.createCreationalContext(bean);

                Object target = beanManager.getReference(bean, type, creationalContext);
View Full Code Here


        try {
            final BeanManager manager = (BeanManager) new InitialContext().lookup(STANDARD_BEAN_MANAGER_JNDI_NAME);

            if (manager != null && Container.available()) {

                final Bean<BoundSessionContext> sessionContextBean = (Bean<BoundSessionContext>) manager.resolve(manager
                        .getBeans(BoundSessionContext.class, BoundLiteral.INSTANCE));
                CreationalContext<?> ctx = manager.createCreationalContext(sessionContextBean);
                final BoundSessionContext sessionContext = (BoundSessionContext) manager.getReference(sessionContextBean,
                        BoundSessionContext.class, ctx);
                sessionContext.associate(sessionContexts.get());
View Full Code Here

                final BoundSessionContext sessionContext = (BoundSessionContext) manager.getReference(sessionContextBean,
                        BoundSessionContext.class, ctx);
                sessionContext.associate(sessionContexts.get());
                sessionContext.activate();

                final Bean<BoundRequestContext> requestContextBean = (Bean<BoundRequestContext>) manager.resolve(manager
                        .getBeans(BoundRequestContext.class, BoundLiteral.INSTANCE));
                ctx = manager.createCreationalContext(requestContextBean);
                final BoundRequestContext requestContext = (BoundRequestContext) manager.getReference(requestContextBean,
                        BoundRequestContext.class, ctx);
                requestContext.associate(requestContexts.get());
View Full Code Here

                final BoundRequestContext requestContext = (BoundRequestContext) manager.getReference(requestContextBean,
                        BoundRequestContext.class, ctx);
                requestContext.associate(requestContexts.get());
                requestContext.activate();

                final Bean<BoundConversationContext> conversationContextBean = (Bean<BoundConversationContext>) manager
                        .resolve(manager.getBeans(BoundConversationContext.class, BoundLiteral.INSTANCE));
                ctx = manager.createCreationalContext(conversationContextBean);
                final BoundConversationContext conversationContext = (BoundConversationContext) manager.getReference(
                        conversationContextBean, BoundConversationContext.class, ctx);
                BoundRequest request = new MutableBoundRequest(requestContexts.get(), sessionContexts.get());
View Full Code Here

    public void teardown(Map<String, Object> properties) {
        try {
            final BeanManager manager = (BeanManager) new InitialContext().lookup("java:comp/BeanManager");

            if (manager != null && Container.available()) {
                final Bean<BoundSessionContext> sessionContextBean = (Bean<BoundSessionContext>) manager.resolve(manager.getBeans(
                        BoundSessionContext.class, BoundLiteral.INSTANCE));
                CreationalContext<?> ctx = manager.createCreationalContext(sessionContextBean);
                final BoundSessionContext sessionContext = (BoundSessionContext) manager.getReference(sessionContextBean,
                        BoundSessionContext.class, ctx);
                sessionContext.invalidate();
View Full Code Here

                        BoundSessionContext.class, ctx);
                sessionContext.invalidate();
                sessionContext.deactivate();
                sessionContext.dissociate(sessionContexts.get());

                final Bean<BoundRequestContext> requestContextBean = (Bean<BoundRequestContext>) manager.resolve(manager.getBeans(
                        BoundRequestContext.class, BoundLiteral.INSTANCE));
                ctx = manager.createCreationalContext(requestContextBean);
                final BoundRequestContext requestContext = (BoundRequestContext) manager.getReference(requestContextBean,
                        BoundRequestContext.class, ctx);
                requestContext.invalidate();
View Full Code Here

                        BoundRequestContext.class, ctx);
                requestContext.invalidate();
                requestContext.deactivate();
                requestContext.dissociate(requestContexts.get());

                final Bean<BoundConversationContext> conversationContextBean = (Bean<BoundConversationContext>) manager
                        .resolve(manager.getBeans(BoundConversationContext.class, BoundLiteral.INSTANCE));
                ctx = manager.createCreationalContext(conversationContextBean);
                final BoundConversationContext conversationContext = (BoundConversationContext) manager.getReference(
                        conversationContextBean, BoundConversationContext.class, ctx);
                conversationContext.invalidate();
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);
                        creationalContext = bm.createCreationalContext(null);
                        instance = bm.getReference(bean, clazz, creationalContext);
                    }

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

        container.bootContainer();
        container.startApplicationScope();

        final BeanManager beanManager = container.getBeanManager();
        final Class<?> type = type();
        final TwoSeconds bean = TwoSeconds.class.cast(beanManager.getReference(beanManager.resolve(beanManager.getBeans(type)), type, null));

        bean.twoSeconds();

        container.stopApplicationScope();
        container.shutdownContainer();
View Full Code Here

        BeanManager beanManager = (BeanManager) lowercaseConverter.getServletContext()
                .getAttribute(BeanManager.class.getName());
        assertNotNull(beanManager);
        assertEquals(beanManager, getCurrentManager());
        Bean<?> bean = beanManager.resolve(beanManager.getBeans(LowercaseConverter.class));
        LowercaseConverter converter = (LowercaseConverter) beanManager.getReference(bean, LowercaseConverter.class,
                beanManager.createCreationalContext(bean));
        assertEquals(converter.getId(), lowercaseConverter.getId());
    }
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.