Previously every call to provider.get() for a Sisu-managed Provider<T> resulted in a new binding lookup.
These extra lookups are unnecessary because Sisu will automatically update live lookups as injectors come and go. This is done to support dynamic maps/lists of beans, but it does mean we can cache binding lookups and re-use them for single providers as long as we only get instances via BeanEntry.getProvider().get().
Note: we can't use BeanEntry.getValue() when re-using binding lookups because it caches the instance, whereas here we always want to return a fresh bean instance.
Previously every call to
provider.get()
for a Sisu-managedProvider<T>
resulted in a new binding lookup.These extra lookups are unnecessary because Sisu will automatically update live lookups as injectors come and go. This is done to support dynamic maps/lists of beans, but it does mean we can cache binding lookups and re-use them for single providers as long as we only get instances via
BeanEntry.getProvider().get()
.Note: we can't use
BeanEntry.getValue()
when re-using binding lookups because it caches the instance, whereas here we always want to return a fresh bean instance.