Cache singleton results for @Lazy injection points

Includes consistent use of unmodifiable collections.

Closes gh-33841
This commit is contained in:
Juergen Hoeller
2024-11-13 13:29:20 +01:00
parent c3991392df
commit 90ef7ac514
4 changed files with 135 additions and 46 deletions

View File

@@ -32,6 +32,8 @@ import org.springframework.lang.Nullable;
* <p>In a {@link BeanFactory} environment, every {@code ObjectProvider} obtained
* from the factory will be bound to its {@code BeanFactory} for a specific bean
* type, matching all provider calls against factory-registered bean definitions.
* Note that all such calls dynamically operate on the underlying factory state,
* freshly resolving the requested target object on every call.
*
* <p>As of 5.1, this interface extends {@link Iterable} and provides {@link Stream}
* support. It can be therefore be used in {@code for} loops, provides {@link #forEach}