mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
cd2fbb1ec5
Prior to this commit, the search algorithm used to locate a @TestBean factory method within a test class hierarchy incorrectly found factory methods declared in subclasses or nested test classes "below" the class in which the @TestBean field was declared. This resulted in "duplicate bean override" failures for @TestBean overrides which are clearly not duplicates but rather "overrides of an override". This commit ensures that @TestBean factory method resolution is consistent in type hierarchies as well as in enclosing class hierarchies (for @Nested test classes) by beginning the search for a factory method in the class which declares the @TestBean field. Closes gh-34204