-
Notifications
You must be signed in to change notification settings - Fork 38.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Duplicate BeanOverrideHandler
discovered in @Nested
test class hierarchy when upgrading to Spring 6.2.2
#34324
Comments
BeanOverrideHandler
discovered in @Nested
test class hierarchy when upgrading to Spring 6.2.2
What happens if you declare |
Similarly, what happens if you annotate your non-static nested base class with @NestedTestConfiguration(EnclosingConfiguration.OVERRIDE)
abstract class BaseClassForNestedTests {
// ...
} Alternatively, you should be able to annotate |
The change in behavior that you have reported is not related to #34204 but rather results from the changes made to |
This would work, however, in my real-world case I cannot make the base class static.
This fixes the error. |
Thanks for confirming that In light of that, I am closing this issue as "works as designed". Cheers, Sam |
Oh, I’m actually surprised to be honest and thought that this behavior change will be addressed. I think from a developer point of view it will be quite surprising and I’m sure that many developers will not know why the exception occurs and how to fix it (i.e. adding the |
Thanks for the feedback, @bwaldvogel. Although the current behavior (introduced in 6.2.2) may be considered technically correct in terms of the search algorithm, it is also technically a "regression" in behavior for test bean overrides, and as you mentioned, users may not find it readily apparent how an enclosing class can be visited twice by the search algorithm. In light of that, I am reopening this issue with the plan to not search in the enclosing class hierarchy of a supertype of a |
Consider the following test with nested test classes:
When upgrading Spring Boot 3.4.1 to 3.4.2 (which upgrades Spring from 6.2.1 to 6.2.2), the test starts to fail with:
I tried to do a search to find if this issue was already reported. I found #34204 which could be related to this issue.
The text was updated successfully, but these errors were encountered: