forked from spring-projects/spring-framework
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ensure @BeanOverride in subclass takes precedence over superclass
Prior to this commit, a @BeanOverride (such as @TestBean) for a specific target bean which was declared in a superclass always took precedence over a bean override for the same target bean in a subclass, thereby rendering the bean override configuration in the subclass useless. In other words, there was no way for a test class to override a bean override declared in a superclass. To address that, this commit switches from direct use of ReflectionUtils.doWithFields() to a custom search algorithm that traverses the class hierarchy using tail recursion for processing @BeanOverride fields (delegating now to ReflectionUtils.doWithLocalFields() in order to continue to benefit from the caching of declared fields in ReflectionUtils). Closes spring-projectsgh-34194
- Loading branch information
Showing
2 changed files
with
103 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters