-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
EmbeddedKafkaBroker cannot be injected in tests with spring-test context #1806
Comments
However, the I will look when I get back to work next week, but this error is likely an unexpected side effect of trying to inject the broker into a static method (which is wrong). |
I don't think being
However it is true that in my case injecting in a static method prevent me from autowiring it at the class level which would circumvent the issue:
|
As for
Since both extensions will understand the parameter we are trying to resolve, JUnit 5 will force the failure. (Sorry disturbing you during your vacations 😃) |
Correct - we (I) just didn't anticipate someone doing something like this; as I said in the other issue, shutting down the broker is not enough; the test listener containers need to be shut down too. In any case, using |
Ok let's forget about my example 😛. |
Good point, if you leave off
We need to fix |
Resolves spring-projects#1806 When there is a test application context present, do not resolve the broker for parameter resolution. **cherry-pick to all supported branches**
Resolves #1806 When there is a test application context present, do not resolve the broker for parameter resolution. **cherry-pick to all supported branches**
Resolves #1806 When there is a test application context present, do not resolve the broker for parameter resolution. **cherry-pick to all supported branches**
Resolves #1806 When there is a test application context present, do not resolve the broker for parameter resolution. **cherry-pick to all supported branches**
Resolves #1806 When there is a test application context present, do not resolve the broker for parameter resolution. **cherry-pick to all supported branches**
Resolves #1806 When there is a test application context present, do not resolve the broker for parameter resolution. **cherry-pick to all supported branches**
In a JUnit 5 test using a spring-test context, it is not possible to autowire the
EmbeddedKafkaBroker
because there is a resolution clash betweenEmbeddedKafkaCondition
's andSpringExtension
's parameter resolution.For instance:
will fail with error:
The text was updated successfully, but these errors were encountered: