Skip to content

Conversation

@mzeijen
Copy link
Contributor

@mzeijen mzeijen commented Nov 21, 2025

This PR fixes an issue where the ProblemDetailXmlMapperBuilderCustomizer incorrectly applies the ProblemDetailJacksonMixin (intended for JSON) to the Jackson XmlMapper.Builder. It now correctly applies the ProblemDetailJacksonXmlMixin for proper XML serialization.

Previously, with the wrong mixin, Jackson produced XML like this:

<ProblemDetail><status>404</status><title>Not Found</title><spring>boot</spring></ProblemDetail>

After applying the correct mixin, the output matches the expected format as defined in RFC 7807, Appendix A:

<problem xmlns=\"urn:ietf:rfc:7807\"><status>404</status><title>Not Found</title><spring>boot</spring></problem>

This format includes the correct root element (problem) and namespace declaration, consistent with Spring Boot 3.x output.

The related test has been updated accordingly to verify the correct XML output.

The ProblemDetailXmlMapperBuilderCustomizer applied the wrong
ProblemDetail mixin for the Jackson XmlMapper. Namely the
ProblemDetailJacksonMixin, which is intended for JSON.
Now the ProblemDetailJacksonXmlMixin is used instead.
The corresponding test also tested for the wrong XML output,
which has been adjusted.

Signed-off-by: Maurice Zeijen <[email protected]>
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Nov 21, 2025
@wilkinsona wilkinsona changed the title Corrected ProblemDetail mixin for XmlMapper.Builder ProblemDetail is rendered to XML incorrectly Nov 21, 2025
@wilkinsona wilkinsona added type: bug A general bug and removed status: waiting-for-triage An issue we've not yet triaged labels Nov 21, 2025
@wilkinsona wilkinsona added this to the 4.0.x milestone Nov 21, 2025
@wilkinsona wilkinsona added type: regression A regression from a previous release and removed type: bug A general bug labels Nov 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: regression A regression from a previous release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants