Skip to content
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

Consider adding @SpringJsonType or similar #25574

Closed
garyrussell opened this issue Aug 10, 2020 · 4 comments
Closed

Consider adding @SpringJsonType or similar #25574

garyrussell opened this issue Aug 10, 2020 · 4 comments
Labels
in: messaging Issues in messaging modules (jms, messaging) status: declined A suggestion or change that we don't feel we should currently apply

Comments

@garyrussell
Copy link
Contributor

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 method Map<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.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Aug 10, 2020
@sbrannen sbrannen added for: team-attention in: messaging Issues in messaging modules (jms, messaging) labels Aug 11, 2020
@rstoyanchev
Copy link
Contributor

@garyrussell since you need the changes anyway, how about preparing a proposal? Having something concrete to look at should be very helpful. Hopefully it isn't too hard to move the PR, if needed, to a different project.

@garyrussell
Copy link
Contributor Author

@rstoyanchev Sure; will do.

@garyrussell
Copy link
Contributor Author

@rstoyanchev Proposal here: spring-projects/spring-kafka#1562

@rstoyanchev
Copy link
Contributor

rstoyanchev commented Aug 28, 2020

Team Decision: after a discussion we've decided this doesn't fit well in spring-messaging which supports the invocation of handler methods where target type information is already available. It could help spring-jms but having it there doesn't help Spring Kafka. So for the time being no good way to share a solution.

@rstoyanchev rstoyanchev added status: declined A suggestion or change that we don't feel we should currently apply and removed status: waiting-for-triage An issue we've not yet triaged or decided on for: team-attention labels Aug 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: messaging Issues in messaging modules (jms, messaging) status: declined A suggestion or change that we don't feel we should currently apply
Projects
None yet
Development

No branches or pull requests

4 participants