You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Bean Override in superclass takes precedence over Bean Override in subclassĀ #34194
While working on #33925, I noticed that the search algorithm for @BeanOverride-annotated fields registers bean override handlers with "bottom up" semantics; whereas, handlers should be registered with "top down" semantics while traversing a test class hierarchy.
In other words, a bean override in a superclass currently takes precedence over a bean override in a subclass, which is incorrect.
Example
@ExtendWith(SpringExtension.class)
classBaseTests {
@TestBean("enigma")
Stringenigma;
staticStringenigma() {
return"enigma in superclass";
}
@Testvoidtest() {
assertThat(enigma).isEqualTo("enigma in superclass");
}
}
Activity
Ensure @ā BeanOverride in subclass takes precedence over superclass