79572397

Date: 2025-04-14 05:41:50
Score: 0.5
Natty:
Report link

I also made a try : https://framagit.org/FBibonne/poc-java/-/tree/iso8859?ref_type=heads : this litle project tries to reproduce your context with the class ConfigRestClient which provides RestClients to retrieve Product entites (simplified version of your )

Then I made tests mocking a server which serves xml encoding with ISO-8859-1 : https://framagit.org/FBibonne/poc-java/-/blob/iso8859/src/test/java/poc/java/springrestclient/ConfigRestClientTest.java?ref_type=heads : each test configures a mock server to return xml, gets a ResClient from ConfigRestClient and calls retrieve with the RestClient as your method getStuff() does.

The different tests try to explain the problem and suggest a fix :

If you introduced such a RestClient in your application, you would only use it for the problematic endpoint thanks to @Qualifier adn/or @Primary.

I don't think the problem resides in Spring RestClient : in fact, it seems impossible to set up externally the encoding used by Jaxb unmarshalling : see Override declared encoding during unmarshalling with JAXB : the suggested solution is to process byte decoding outside jaxb to control encoding. I neither found in Jaxb a way to do it : jakarta.xml.bind.helpers.AbstractUnmarshallerImpl#setProperty does not support any property set (raise exceptions)

Reasons:
  • Blacklisted phrase (0.5): thanks
  • Whitelisted phrase (-1): solution is
  • Contains signature (1):
  • Long answer (-1):
  • Has code block (-0.5):
  • User mentioned (1): @Qualifier
  • User mentioned (0): @Primary
  • Low reputation (0.5):
Posted by: FBibonne