<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">Hello everyone,</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">I am in the process of patching the softwaremill-common CDI extensions [1] from Weld 1.1 to Weld 2.x. I am currently working on their extension for autofactories. I stumbled upon the following piece of code I would like to migrate:</div><div class=""><br class=""></div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CurrentInjectionPoint currentInjectionPoint = Container.instance().services().get(CurrentInjectionPoint.class);</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; currentInjectionPoint.push(ConstructorInjectionPoint.of(bean, (WeldConstructor&lt;T&gt;) createdTypeData.getCreatedTypeConstructor()));</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; instance = newInstance(parameters);</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; currentInjectionPoint.pop();</div><div class=""><br class=""></div><div class="">Source: [2]</div><div class=""><br class=""></div><div class="">I see how the pop should now be invoked on the `ThreadLocalStackReference` returned by the push method. I have also found the InjectionPointFactory#createConstructorInjectionPoint(Bean, Class, EnhancedAnnotatedConstructor, BeanManagerImpl) method [3]. Now I am wondering how I can get to the `EnhancedAnnotatedConstructor`, as the approach I am currently using feels plain wrong.</div><div class=""><br class=""></div><div class="">My code:</div><div class=""><br class=""></div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; CurrentInjectionPoint currentInjectionPoint = Container.instance().services().get(CurrentInjectionPoint.class);</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; Class&lt;?&gt; declaringComponentClass = (Class&lt;T&gt;) createdTypeData.getCreatedTypeConstructor().getBaseType();</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; BeanManagerImpl manager = ((BeanManagerProxy) beanManager).delegate();</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; EnhancedAnnotatedConstructor&lt;T&gt; constructor = (EnhancedAnnotatedConstructor&lt;T&gt;) manager</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .createEnhancedAnnotatedType(declaringComponentClass)</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .getEnhancedConstructors()</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .stream().findAny().get();</div><div class=""><br class=""></div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ConstructorInjectionPoint&lt;T&gt; actualInjectionPoint = InjectionPointFactory.instance()</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; .createConstructorInjectionPoint(bean, declaringComponentClass, constructor, manager);</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ThreadLocalStackReference&lt;InjectionPoint&gt; ref = currentInjectionPoint.push(actualInjectionPoint);</div><div class="">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; instance = newInstance(parameters);</div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">My code is also available on Github at [4]. My question is also posted on Stackoverflow [5], so points will be awarded for the answer.</div><div class=""><br class=""></div><div class="">Thanks in advance!</div><div class=""><br class=""></div><div class="">Jan-Willem Gmelig Meyling</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""><br class=""></div><div class="">[1] <a href="https://github.com/softwaremill/softwaremill-common/tree/master/softwaremill-cdi" class="">https://github.com/softwaremill/softwaremill-common/tree/master/softwaremill-cdi</a></div><div class="">[2]&nbsp;<a href="https://github.com/softwaremill/softwaremill-common/blob/master/softwaremill-cdi/src/main/java/com/softwaremill/common/cdi/autofactory/extension/FactoryInvocationHandler.java#L35-L48" class="">https://github.com/softwaremill/softwaremill-common/blob/master/softwaremill-cdi/src/main/java/com/softwaremill/common/cdi/autofactory/extension/FactoryInvocationHandler.java#L35-L48</a></div><div class="">[3] <a href="http://javadox.com/org.jboss.weld.servlet/weld-servlet/2.3.1.Final/org/jboss/weld/injection/InjectionPointFactory.html#createConstructorInjectionPoint-javax.enterprise.inject.spi.Bean-java.lang.Class-org.jboss.weld.annotated.enhanced.EnhancedAnnotatedConstructor-org.jboss.weld.manager.BeanManagerImpl-" class="">http://javadox.com/org.jboss.weld.servlet/weld-servlet/2.3.1.Final/org/jboss/weld/injection/InjectionPointFactory.html#createConstructorInjectionPoint-javax.enterprise.inject.spi.Bean-java.lang.Class-org.jboss.weld.annotated.enhanced.EnhancedAnnotatedConstructor-org.jboss.weld.manager.BeanManagerImpl-</a></div><div class="">[4]&nbsp;<a href="https://github.com/JWGmeligMeyling/cdi-autofactories/blob/8346cf269d73a8bd455c12c4d467df7bcb8f3920/src/main/java/com/softwaremill/common/cdi/autofactory/extension/FactoryInvocationHandler.java#L50-L60" class="">https://github.com/JWGmeligMeyling/cdi-autofactories/blob/8346cf269d73a8bd455c12c4d467df7bcb8f3920/src/main/java/com/softwaremill/common/cdi/autofactory/extension/FactoryInvocationHandler.java#L50-L60</a></div><div class="">[5]&nbsp;<a href="http://stackoverflow.com/questions/38436110/proper-way-to-get-enhancedannotatedconstructor" class="">http://stackoverflow.com/questions/38436110/proper-way-to-get-enhancedannotatedconstructor</a></div><div class=""><br class=""></div><div class=""><br class=""></div></body></html>