mirror of
https://github.com/spring-projects/spring-framework
synced 2026-06-08 17:33:33 +00:00
ef4f1f0a71
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 gh-34194