Uploaded image for project: 'Weld'
  1. Weld
  2. WELD-2467

Own ConversationContext is not known by the ConversationBean

XMLWordPrintable

    • Hide

      Having multiple deployment archives is necessary.

      final BeanManagerImpl bmImpl = BeanManagerProxy.unwrap(bm);
      final String contextId = bmImpl.getContextId();
      final BeanIdentifierIndex beanIdentifierIndex = bmImpl.getServices().get(BeanIdentifierIndex.class);
      
      final Set<Annotation> boundQualifiers = ImmutableSet.<Annotation> builder().addAll(Bindings.DEFAULT_QUALIFIERS).add(BoundLiteral.INSTANCE).build();
      
      final ContextHolder<MyConversationContext> cch = new ContextHolder<>(new MyConversationContext(contextId, beanIdentifierIndex), MyConversationContext.class, boundQualifiers);
      abd.addBean(ContextBean.of(cch, bmImpl));
      abd.addContext(cch.getContext());
      

      In a different deployment archive inject

      @Inject
      Conversation conv
      

      and access it.

      Show
      Having multiple deployment archives is necessary. final BeanManagerImpl bmImpl = BeanManagerProxy.unwrap(bm); final String contextId = bmImpl.getContextId(); final BeanIdentifierIndex beanIdentifierIndex = bmImpl.getServices().get(BeanIdentifierIndex.class); final Set<Annotation> boundQualifiers = ImmutableSet.<Annotation> builder().addAll(Bindings.DEFAULT_QUALIFIERS).add(BoundLiteral.INSTANCE).build(); final ContextHolder<MyConversationContext> cch = new ContextHolder<>( new MyConversationContext(contextId, beanIdentifierIndex), MyConversationContext.class, boundQualifiers); abd.addBean(ContextBean.of(cch, bmImpl)); abd.addContext(cch.getContext()); In a different deployment archive inject @Inject Conversation conv and access it.

      When adding the Context and the ContextBean in our own extension (AfterBeanDiscovery) the Context is visible in each BeanManger but the ContextBean not.

      It seems that the DeploymentVistor which is executed after Bean discovery does not copy the bean to all deployment archives. The detection is done by seenBeanDeploymentArchives Set.

              Unassigned Unassigned
              thomas.woeckinger@gmail.com Thomas Wöckinger-Biermair (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: