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

Consider adding a handler interface for lazily-initialized dependencies

XMLWordPrintable

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

      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.

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

              Created:
              Updated: