Uploaded image for project: 'Tools (JBoss Tools)'
  1. Tools (JBoss Tools)
  2. JBIDE-9428

Support injection of Provider<X> beans

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 3.3.0.M3
    • 3.3.0.M2
    • cdi
    • None

    Description

      5.6.2. The built-in Instance
      The container must provide a built-in bean with:
      • Instance<X> and Provider<X> for every legal bean type X in its set of bean types,
      • every qualifier type in its set of qualifier types,
      • scope @Dependent,
      • no bean EL name, and
      • an implementation provided automatically by the container.

      Since Instance extends Provider, CDI implementations are likely to just implement Instance interface, which automatically supports injections of Provider<X> as well as that of Instance<X>. So, in practice, there is no difference between these two injections, but formally, Provider interface misses methods narrowing the set of eligible beans and methods for checking if that set is ambiguous or unsatisfied; the only method get() throws RuntimeException in such cases, so that it is logical to perform validation of Provider<X> injection in the same way as X injection.

      EXECUTE: Create in a CDI project bean class Bean and injection point

      @Inject Provider<Bean> b;
      

      ASSERT: Injection point is not marked as unsatisfied.
      ASSERT: Open-on for @Inject has an option that opens Bean class.

      Attachments

        Activity

          People

            scabanovich Viacheslav Kabanovich (Inactive)
            scabanovich Viacheslav Kabanovich (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: