Uploaded image for project: 'CDI Specification Issues'
  1. CDI Specification Issues
  2. CDI-683

BeanConfigurator#produceWith(Function) does not allow access to InjectionPoint

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 2.0 .Final
    • Fix Version/s: None
    • Component/s: Beans
    • Labels:
      None

      Description

      The BeanConfigurator#produceWith(Function) method is intended to simulate a producer method, and is quite convenient.

      The Function that it takes accepts one parameter which is of type Instance<Object>. This is supposed to allow "faking" parameter injection in a producer method.

      One of the parameters that you commonly want in a producer method is the InjectionPoint for which the return value of the producer method is destined.

      If you try to "get" this InjectionPoint like this:

      final Instance<InjectionPoint> injectionPointInstance = instance.select(InjectionPoint.class);
      final InjectionPoint injectionPoint = injectionPointInstance.get();
      

      ...the InjectionPoint returned is not the one you want, but instead a strange InjectionPoint that seems to represent something in the Instance class itself.

      The InjectionPoint javadocs say this about the matter:

      If the injection point is a dynamically selected reference obtained [sic] then the metadata obtain [sic] reflects the injection point of the Instance, with the required type and any additional required qualifers [sic] defined by Instance.select().

      I observe that Weld's behavior in this case matches the javadocs (if I'm understanding them right), but surely I should be able to get the InjectionPoint that is being serviced by my simulated producer method.

        Gliffy Diagrams

          Attachments

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                ljnelson Laird Nelson
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated: