PartitionKeyExtractorStrategy instances do not have access to application context
See original GitHub issueWhen selecting the partion of a kafka topic using a custom PartitionKeyExtractorStrategy, the instantiated objects are not initialized to use configuration values or beans from the application context. This would be very useful when selecting the partition based on a configurable value.
I have a provided a demo. When starting it, the logging shows that the inserted @Value is null and not properly initialized.
If this is on purpose the documentation should provide more information what is initialized into the this object.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
8. Inter-Application Communication - Spring
When scaling up Spring Cloud Stream applications, each instance can receive information about how many other instances of the same application exist and ......
Read more >Getting Spring Application Context - java - Stack Overflow
getApplicationContext()(Singleton pattern) , which returns a instance of new XXXXApplicationContext(XXXX), why it is not work? Why Do I have to autowired it? – ......
Read more >spring-cloud/spring-cloud-stream - Gitter
Now, when trying to publish messages we get an error, "Magic V1 does not support record headers". So we tried configuring setting type...
Read more >Super simple approach to accessing Spring beans from non ...
How can I inject Spring managed beans into POJO's and classes not ... can access said instance of ApplicationContext and use that to...
Read more >Spring Web Contexts - Baeldung
That's an interface extending ApplicationContext with a contract for accessing the ServletContext. Anyway, applications usually should not ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Maybe replace it with a
beanName?This was a carry-over from Spring XD where it was less-easy to add custom beans to the context.
@garyrussell @ilayaperumalg I am reviewing https://github.com/spring-cloud/spring-cloud-stream/issues/760 - wondering if we should consider deprecating this mechanism in a future release (1.2?) - at the risk of disabling creating such configurations per-binding. The whole mechanism is somewhat un-Spring-like.