question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

MappingJackson2XmlHttpMessageConverterConfiguration and spring.xml.ignore property

See original GitHub issue

I’m upgrading an application from SpringBoot2.6 to SprintBoot2.7 (2.7.4). It relies on Azure SDK for Java, which has a dependency over jackson-xml. This is discussed in https://github.com/Azure/azure-sdk-for-java/issues/7694, and one solution to workaround this is to rely on a spring.properties file holding spring.xml.ignore=true.

While this covers many cases, I have unit-tests which are still failing as XML output is produced. It appears JacksonHttpMessageConvertersConfiguration.MappingJackson2XmlHttpMessageConverterConfiguration has no exclusion relating to spring.xml.ignore=true, hence MappingJackson2XmlHttpMessageConverter is being injected into HttpMessageConverters.

There is HttpMessageConverters.reorderXmlConvertersToEnd which may help, but it covers only defaultConverters, not the input converters as provided by HttpMessageConvertersAutoConfiguration

Why JacksonHttpMessageConvertersConfiguration.MappingJackson2XmlHttpMessageConverterConfiguration isn’t excluded by spring.xml.ignore=true?

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:20 (18 by maintainers)

github_iconTop GitHub Comments

1reaction
snicollcommented, Oct 12, 2022

Why isn’t it deprecated then

Why would we deprecate something that’s internal, not meant to be used externally and not documented. Let’s stop this discussion please. Brian also shared previously that “This option was never meant to be officially supported in the first place”.

1reaction
wilkinsonacommented, Oct 11, 2022

@blacelle That test passes for me once I’d updated expected to be {'Intro to Spring Boot':'Spring team'} (a : rather than a , between the two strings). There must be something else going on in your case that you haven’t shared, such as auto-configuration of Spring MVC being disabled. Can you please provide a complete yet minimal sample that reproduces the problem? That sample should be something that we can run without any copy-paste or modifications and reproduce the problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tell Jackson to ignore property only when generating an xml
I have a JPA entity which is exposed via REST (Spring Boot). I'd like to tell Jackson to ignore e.g. the property street...
Read more >
Jackson Ignore Properties on Marshalling - Baeldung
This tutorial will show how to ignore certain fields when serializing an object to JSON using Jackson 2.x.
Read more >
spring-projects/spring-boot - Gitter
Hey everyone. After updating to Gradle 7.6 is seems that src/main/resources/META-INF/additional-spring-configuration-metadata.json is ignored, when Gradle does ...
Read more >
PropertySource (Spring Framework 6.0.2 API)
properties or .xml resource. ${...} placeholders will be resolved against any/all property sources already registered with the Environment . See above ...
Read more >
Spring @PropertySource - DigitalOcean
Spring PropertySource ignore FileNotFoundException. If the property file is not found, then we will get FileNotFoundException . Sometimes we don ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found