Skip to content

Commit

Permalink
Add note on declaring autowired fields as ObjectProvider
Browse files Browse the repository at this point in the history
Closes gh-33834
  • Loading branch information
jhoeller committed Nov 13, 2024
1 parent 01c85b1 commit 62eb21f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
* {@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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -30,6 +30,10 @@
* <p>See @{@link EnableTransactionManagement} for general examples and context;
* see {@link #annotationDrivenTransactionManager()} for detailed instructions.
*
* <p><b>NOTE: A {@code TransactionManagementConfigurer} 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.
*
* <p>Note that in by-type lookup disambiguation cases, an alternative approach to
* implementing this interface is to simply mark one of the offending
* {@code PlatformTransactionManager} {@code @Bean} methods (or
Expand Down

0 comments on commit 62eb21f

Please sign in to comment.