<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=""> CurrentInjectionPoint currentInjectionPoint = Container.instance().services().get(CurrentInjectionPoint.class);</div><div class=""> currentInjectionPoint.push(ConstructorInjectionPoint.of(bean, (WeldConstructor<T>) createdTypeData.getCreatedTypeConstructor()));</div><div class=""> instance = newInstance(parameters);</div><div class=""> 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=""> CurrentInjectionPoint currentInjectionPoint = Container.instance().services().get(CurrentInjectionPoint.class);</div><div class=""> Class<?> declaringComponentClass = (Class<T>) createdTypeData.getCreatedTypeConstructor().getBaseType();</div><div class=""><br class=""></div><div class=""><br class=""></div><div class=""> BeanManagerImpl manager = ((BeanManagerProxy) beanManager).delegate();</div><div class=""> EnhancedAnnotatedConstructor<T> constructor = (EnhancedAnnotatedConstructor<T>) manager</div><div class=""> .createEnhancedAnnotatedType(declaringComponentClass)</div><div class=""> .getEnhancedConstructors()</div><div class=""> .stream().findAny().get();</div><div class=""><br class=""></div><div class=""> ConstructorInjectionPoint<T> actualInjectionPoint = InjectionPointFactory.instance()</div><div class=""> .createConstructorInjectionPoint(bean, declaringComponentClass, constructor, manager);</div><div class=""> ThreadLocalStackReference<InjectionPoint> ref = currentInjectionPoint.push(actualInjectionPoint);</div><div class=""> 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] <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] <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] <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>