-
Feature Request
-
Resolution: Unresolved
-
Minor
-
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.