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

Support JAXBElement in Jaxb2XmlEncoder #30552

Closed
nstdio opened this issue May 27, 2023 · 3 comments
Closed

Support JAXBElement in Jaxb2XmlEncoder #30552

nstdio opened this issue May 27, 2023 · 3 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: feedback-provided Feedback has been provided type: enhancement A general enhancement
Milestone

Comments

@nstdio
Copy link

nstdio commented May 27, 2023

The Jaxb2XmlEncoder seem to not support JAXBElement type while Marshaller can encode it. The use case for it is when one have the XML binding class that one don't own and cannot add @XmlRootElement.

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label May 27, 2023
@bclozel
Copy link
Member

bclozel commented May 27, 2023

Can you share a sample application (ideally one created with start.spring.io) that demonstrates the problem please?

@bclozel bclozel added status: waiting-for-feedback We need additional information before we can continue in: core Issues in core modules (aop, beans, core, context, expression) labels May 27, 2023
@nstdio
Copy link
Author

nstdio commented May 27, 2023

Sure you can find the failing test case in gh-30552.zip

@spring-projects-issues spring-projects-issues added status: feedback-provided Feedback has been provided and removed status: waiting-for-feedback We need additional information before we can continue labels May 27, 2023
@nstdio
Copy link
Author

nstdio commented May 27, 2023

I wonder why would Jaxb2XmlEncoder support classes annotated with @XmlRootElement or @XmlType, when underlying marshaller is unable to encode classes annotated only @XmlType. Maybe there is something I'm missing?

@poutsma poutsma changed the title Jaxb2XmlEncoder unable to encode JAXBElement Support JAXBElement in Jaxb2XmlEncoder Jun 8, 2023
@poutsma poutsma self-assigned this Jun 8, 2023
@poutsma poutsma added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Jun 8, 2023
@poutsma poutsma added this to the 6.1.0-M1 milestone Jun 8, 2023
@poutsma poutsma closed this as completed in d7970e4 Jun 8, 2023
sbrannen pushed a commit that referenced this issue Jun 7, 2024
Commit d7970e4 introduced support for JAXBElement in
Jaxb2XmlEncoder's encodeValue() method; however, canEncode() still
returned false for a JAXBElement element type.

This commit revises canEncode() so that it returns true for an element
type that is assignable from JAXBElement.

See gh-30552
See gh-32972
Closes gh-32977
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: feedback-provided Feedback has been provided type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

4 participants