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

InjectionPoint can't retrieved for dependent bean from Instance parameter of SyntheticBeanCreator.create()

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Cannot Reproduce
    • Icon: Major Major
    • None
    • None
    • Extensions
    • None
    • Hide

      These are the snippets of importance.

       

      ``` 

      public class PropertyResolverBean implements SyntheticBeanCreator<PropertyValue> {

      public PropertyValue create(Instance lookup, Parameters params)

      {    Instance injectionPoint = lookup.select(InjectionPoint.class);    System.out.println("InjectionPoint available "+injectionPoint.isResolvable()); }

      }
      ```

      For a synthetic bean like this (Synthetic phase)

      ```
      @Synthesis
      public void addConfigProducer(SyntheticComponents syntheticComponents)

      {    syntheticComponents.addBean(PropertyValue.class)       .name("PropertyResolverBean")       .type(PropertyValue.class)       .qualifier(Property.class)       //.scope(Dependent.class)       .createWith(PropertyResolverBean.class); }

      ```

      Show
      These are the snippets of importance.   ```  public class PropertyResolverBean implements SyntheticBeanCreator<PropertyValue> { public PropertyValue create(Instance lookup, Parameters params) {    Instance injectionPoint = lookup.select(InjectionPoint.class);    System.out.println("InjectionPoint available "+injectionPoint.isResolvable()); } } ``` For a synthetic bean like this (Synthetic phase) ``` @Synthesis public void addConfigProducer(SyntheticComponents syntheticComponents) {    syntheticComponents.addBean(PropertyValue.class)       .name("PropertyResolverBean")       .type(PropertyValue.class)       .qualifier(Property.class)       //.scope(Dependent.class)       .createWith(PropertyResolverBean.class); } ```

      According to the javadoc of  SyntheticBeanCreator.create()

      >If the synthetic bean is @Dependent, the InjectionPoint to which it is injected may be looked up from the Instance parameter.

      But `InjectionPoint` cannot be looked up (isResolvable() returns false)

      version: Weld 5.0.1.Final (using Payara Micro 6.2021.1)

              manovotn Matěj Novotný
              rdebusscher@gmail.com Rudy De Busscher (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: