79681958

Date: 2025-06-27 12:41:26
Score: 0.5
Natty:
Report link

I know this answer is very late, but I'm adding it just in case it is helpful to someone currently working on this issue.

We ran into this issue, and what we did was to replace the default string serializer class with a custom one that can read both the old format and the new format. When I was upgrading from Spring Boot 1.5 to 2.7 I did the following:

  1. I wrote a custom XStream-based XStreamExecutionContextStringSerializer that could read the old format.

  2. I then created a XStreamOrJackson2ExecutionContextStringSerializer that wrapped both an XStreamExecutionContextStringSerializer and a Jackson2ExecutionContextStringSerializer. This composite class would call the Jackson2ExecutionContextStringSerializer.deserialize() method inside of a try-catch. If the method threw a JsonProcessingException it would reset the stream, and call the XStreamExecutionContextStringSerializer. This way, it could handle both old ExecutionContext, and new ones.

  3. The XStreamOrJackson2ExecutionContextStringSerilizer.serialize() method simply delegated to Jackson2ExecutionContextStringSerializer.serialize(). This meant that over time, all of the old ExecutionContexts would get re-written in the Jackson2 format.

At some point we determined that every ExecutionContext in the database had been updated to the new format, and we dropped this composite string serializer class, and deleted the XStreamExecutionContextStringSerializer.

Sorry I can't post the example code, it's a proprietary code-base, but this should give you enough information to get past the issue.

Reasons:
  • RegEx Blacklisted phrase (0.5): Sorry I can't
  • Long answer (-1):
  • No code block (0.5):
  • Low reputation (0.5):
Posted by: dsharp