Add note on declaring autowired fields as ObjectProvider

Closes gh-33834
This commit is contained in:
Juergen Hoeller
2024-11-13 15:09:58 +01:00
parent 01c85b1afb
commit 62eb21f938
2 changed files with 9 additions and 1 deletions

View File

@@ -32,6 +32,10 @@ import org.springframework.lang.Nullable;
* {@link #cacheManager()}, {@link #cacheResolver()}, {@link #keyGenerator()}, and
* {@link #errorHandler()} for detailed instructions.
*
* <p><b>NOTE: A {@code CachingConfigurer} will get initialized early.</b>
* Do not inject common dependencies into autowired fields directly; instead, consider
* declaring a lazy {@link org.springframework.beans.factory.ObjectProvider} for those.
*
* @author Chris Beams
* @author Stephane Nicoll
* @since 3.1