<div dir="ltr"><div><div>Thank you Jozef for your quick reply! <br><br>The point is that Weld creates the non-cdi interceptors, so we don&#39;t have control over. We can only control how to create the managed beans, which I think the defult setting for the injectionTarget are correct (interceptor, decorator, lifecycle call and resource injection enabled). <br><br>After further debugging, below is the calling stack for creating non-cdi interceptors<br><br>




<table></table>BasicInjectionTarget&lt;T&gt;.createNonCdiInterceptor(EnhancedAnnotatedType&lt;T&gt;, BeanManagerImpl) line: 69        <br>InjectionTargetFactoryImpl&lt;T&gt;.chooseInjectionTarget(EnhancedAnnotatedType&lt;T&gt;, Bean&lt;T&gt;, boolean) line: 126        <br>InjectionTargetFactoryImpl&lt;T&gt;.createInjectionTarget(EnhancedAnnotatedType&lt;T&gt;, Bean&lt;T&gt;, boolean) line: 87        <br>InjectionTargetFactoryImpl&lt;T&gt;.createInjectionTarget(Bean&lt;T&gt;, boolean) line: 80        <br>InjectionTargetFactoryImpl&lt;T&gt;.createInterceptorInjectionTarget() line: 75        <br>PlainInterceptorFactory&lt;T&gt;.of(Class&lt;T&gt;, BeanManagerImpl) line: 41        <br>InterceptorMetadataReader$1.load(Class&lt;?&gt;) line: 44        <br>InterceptorMetadataReader$1.load(Object) line: 39        <br>LocalCache$LoadingValueReference&lt;K,V&gt;.loadFuture(K, CacheLoader&lt;? super K,V&gt;) line: 3599        <br>LocalCache$Segment&lt;K,V&gt;.loadSync(K, int, LoadingValueReference&lt;K,V&gt;, CacheLoader&lt;? super K,V&gt;) line: 2379        <br>LocalCache$Segment&lt;K,V&gt;.lockedGetOrLoad(K, int, CacheLoader&lt;? super K,V&gt;) line: 2342        <br>LocalCache$Segment&lt;K,V&gt;.get(K, int, CacheLoader&lt;? super K,V&gt;) line: 2257        <br>LocalCache&lt;K,V&gt;.get(K, CacheLoader&lt;? super K,V&gt;) line: 4000        <br>LocalCache&lt;K,V&gt;.getOrLoad(K) line: 4004        <br>LocalCache$LocalLoadingCache&lt;K,V&gt;.get(K) line: 4874        <br>LoadingCacheUtils.getCacheValue(LoadingCache&lt;K,V&gt;, K) line: 49        <br>LoadingCacheUtils.getCastCacheValue(LoadingCache&lt;K,V&gt;, Object) line: 74        <br>InterceptorMetadataReader.getPlainInterceptorMetadata(Class&lt;T&gt;) line: 64        <br>InterceptionModelInitializer&lt;T&gt;.initClassDeclaredEjbInterceptors() line: 233        <br>InterceptionModelInitializer&lt;T&gt;.initEjbInterceptors() line: 217        <br>InterceptionModelInitializer&lt;T&gt;.init() line: 103        <br>BeanInjectionTarget&lt;T&gt;.buildInterceptionModel(EnhancedAnnotatedType&lt;T&gt;, AbstractInstantiator&lt;T&gt;) line: 93        <br>BeanInjectionTarget&lt;T&gt;.initializeInterceptionModel(EnhancedAnnotatedType&lt;T&gt;) line: 88        <br>BeanInjectionTarget&lt;T&gt;.initializeAfterBeanDiscovery(EnhancedAnnotatedType&lt;T&gt;) line: 98        <br>InjectionTargetInitializationContext&lt;T&gt;.initialize() line: 42        <br>InjectionTargetService.addInjectionTargetToBeInitialized(InjectionTargetInitializationContext&lt;?&gt;) line: 55        <br>InjectionTargetService.addInjectionTargetToBeInitialized(EnhancedAnnotatedType&lt;T&gt;, BasicInjectionTarget&lt;T&gt;) line: 49        <br>InjectionTargetFactoryImpl&lt;T&gt;.initialize(BasicInjectionTarget&lt;T&gt;) line: 145        <br>InjectionTargetFactoryImpl&lt;T&gt;.createInjectionTarget(EnhancedAnnotatedType&lt;T&gt;, Bean&lt;T&gt;, boolean) line: 92        <br>InjectionTargetFactoryImpl&lt;T&gt;.createInjectionTarget(Bean&lt;T&gt;, boolean) line: 80        <br>InjectionTargetFactoryImpl&lt;T&gt;.createInjectionTarget(Bean&lt;T&gt;) line: 70        <br>InjectionTargetFactoryImpl&lt;T&gt;.createInjectionTarget(Bean) line: 54        

<br><br></div>This following line on BasicInjectionTarget uses the DefaultInjector, which does not support resource injection.<br>




<table>
</table><span class="" style="font-size:10pt;font-family:Liberation Sans;color:rgb(26,26,26)"> return new BasicInjectionTarget&lt;T&gt;(type, null, beanManager, DefaultInjector.of(type, null, beanManager), NoopLifecycleCallbackInvoker.&lt;T&gt;getInstance());</span> 

<br><br></div>I might have missed your point. Please elaborate a bit more.<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Jun 3, 2015 at 6:49 AM, Jozef Hartinger <span dir="ltr">&lt;<a href="mailto:jharting@redhat.com" target="_blank">jharting@redhat.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div text="#000000" bgcolor="#FFFFFF">
    That&#39;s expected. The non-cdi interceptors are expected to be
    partially managed by the EE container (resource injection). If you
    need resource injection in the non-CDI interceptors you can use
    InjectionTargetBuilder to customize this behavior, e.g:<br>
    <br>
    beanManager.createInjectionTargetBuilder(type)<br>
        .setDecorationEnabled(false)<br>
        .setInterceptionEnabled(false)<br>
        .setTargetClassLifecycleCallbacksEnabled(false)<br>
        .setResourceInjectionEnabled(true)<br>
        .build()<div><div class="h5"><br>
    <br>
    <div>On 06/02/2015 06:15 PM, Emily Jiang
      wrote:<br>
    </div>
    </div></div><blockquote type="cite"><div><div class="h5">
      <div dir="ltr">
        <div>
          <div>
            <div><br clear="all">
            </div>
            For managed beans (@ManagedBean classes), they are java EE
            component classes. They support both cdi and non-cdi
            interceptors. When I create a instance using
            injectionTarget.produce(), I got hold of the instance with
            both cdi and non-cdi interceptors associated. However, the
            @Resource injection point on the non-cdi interceptors are
            not injected when Weld creates the interceptor instances.<br>
            <br>
          </div>
          Is there anything I have missed or this is a bug?<br>
        </div>
        <div>
          <div>
            <div>-- <br>
              <div>Thanks<br>
                Emily<br>
                =================<br>
                Emily Jiang<br>
                <a href="mailto:ejiang@apache.org" target="_blank">ejiang@apache.org</a><br>
              </div>
            </div>
          </div>
        </div>
      </div>
      <br>
      <fieldset></fieldset>
      <br>
      </div></div><pre>_______________________________________________
weld-dev mailing list
<a href="mailto:weld-dev@lists.jboss.org" target="_blank">weld-dev@lists.jboss.org</a>
<a href="https://lists.jboss.org/mailman/listinfo/weld-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/weld-dev</a></pre>
    </blockquote>
    <br>
  </div>

</blockquote></div><br><br clear="all"><br>-- <br><div class="gmail_signature">Thanks<br>Emily<br>=================<br>Emily Jiang<br><a href="mailto:ejiang@apache.org" target="_blank">ejiang@apache.org</a><br></div>
</div>