Consider adding @SpringJsonType or similar #25574
Labels
in: messaging
Issues in messaging modules (jms, messaging)
status: declined
A suggestion or change that we don't feel we should currently apply
See spring-projects/spring-kafka#1549
Several Spring projects (spring-jms, spring-amqp, spring-kafka, ...) have mechanisms for mapping a
typeId
token to/from a class name, allowing decoupling of concrete types between sender and receiver.The issue (in spring-kafka) is asking for a scan that looks for classes with a typeId annotation and automatically populate the type mapper with the mappings.
Rather than a specific solution for spring-kafka, I think it would be better to provide a generic spring-messaging annotation e.g
SpringJsonType
and, perhaps, a utility methodMap<String, Class<?>> findJsonTypeIds(String... packagesToScan)
.The individual projects could then use this utility to set up their components to use this mapping.
If there is agreement that this would be useful, I can work on a PR.
The text was updated successfully, but these errors were encountered: