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

Consider adding a handler interface for lazily-initialized dependencies

    XMLWordPrintable

Details

    • Feature Request
    • Resolution: Unresolved
    • Minor
    • 3.1.x
    • None
    • None

    Description

      In Dagger 2 this is called Lazy:
      https://google.github.io/dagger/api/latest/dagger/Lazy.html

      A simple and naive CDI impl:
      https://github.com/mkouba/dagger2cdi/blob/master/src/main/java/org/jboss/dagger2cdi/LazyAdaptor.java

      NOTE: This impl does not handle qualifiers correctly. To make this work we would have to detect all injection points with Lazy required type, collect all qualifiers used and add those to the set of qualifiers of the LazyAdaptor bean.

      This probably only makes sense for @Dependent beans. The difference between Lazy and Instance/Provider would be that for Lazy the bean instance would only be obtained once.

      Attachments

        Activity

          People

            Unassigned Unassigned
            mkouba@redhat.com Martin Kouba
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated: