-
Notifications
You must be signed in to change notification settings - Fork 615
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
@Validation annotation on AbstractExtendedBindingProperties causes context initialisation to fail #3071
Comments
I just looked at it and indeed it fails, but i do have a question. . . |
Further more, if you had multiple binder scenario you would have as many instances of |
What we do is call |
Would the |
Regardless of it working before, the approach is fundamentally wrong since even in a single binder scenario you would be getting another instance of the configuration class. So technically I don't se how it worked for you since as I mentioned before binders (single or multiple) run in a separate application context. Can you elaborate on your use case a bit more? I feel like there may be a simpler solution to what you need but need to better understand your requirements for dynamically changing configuration |
Yep, so we have a library which wraps spring cloud stream and provides additional functionality for things like: retry, buffering and claim check pattern for Kafka. It also has its own, simplified configuration, which we use to generate the correct spring cloud stream configuration following our internal standards. During application initialisation, the library reads the bindings and updates them with its own auto-generated consumer configuration. |
Ok, and I assume you have a single binder scenario, not multibinder (e.g., kafka instance1 for input and kafka instance2 for output) |
Yep, that's correct |
Let me think about it. It may work for you now, but it will stop working once a new binder is introduced or other configuration changes are made. It appears this would be a new feature/enhancement. |
Describe the issue
The fix for #2974 causes some of our applications to fail when initialising application context with the following error:
The underlying cause appears to be the addition of the
@Validation
annotation onAbstractExtendedBindingProperties
. When validation is enabled for the application, this causes theKafkaExtendedBindingProperties
bean to be wrapped in a JDK proxy which cannot be cast back to the original type.We autowire
KafkaExtendedBindingProperties
in one of our libraries as part of code that automates Kafka configuration, so any application that uses the library fails to start after upgrading to this version of Spring Cloud Stream.To Reproduce
I have included a small example project with a failing test to demonstrate the problem:
kafka-binding-issue.zip
Version of the framework
Spring Cloud Stream 4.2.0
The text was updated successfully, but these errors were encountered: