Following up on #35330, we should consider more aggressive caching of resolved singleton beans in injected Provider instances. This is not entirely trivial since providers are meant to call back into the core container for a fresh lookup, picking up the current scoped instance or even a changed singleton definition - even if the most common usage is for lazy singleton lookup, so we could consider specific caching in such a lazy singleton scenario (similar to how we cache the target instance behind a @Lazy injection point with a proxy).

Comment From: jhoeller

This is straightforward enough to implement for both jakarta.inject.Provider and ObjectProvider#getObject(): Against a BeanFactory with configuration frozen, we can identify a singleton result and cache it accordingly. I'll roll this into 7.0.2 right away.