When Jackson maps a JSON input to a DTO it automatically decodes base64. I want to disable this decoding for one particular field (which is a byte array), because I transfer it through as-is to an other service through a REST API and the decoding causes an increase in memory usage due to intermediate structures (encoded byte array, decoded byte array, another encoded byte array to send to the other service).
Is there any elegant way to achieve this? I debugged a bit to see what the internal code is like and found the class Base64Variant which unfortunately is final so I cannot override its behaviour. I suppose I can go and copy-paste parts of the internal logic of JsonParser to read the inputstream (minus the base64 decoding) from within a custom deserializer but I first wanted to ask here if anyone has a better solution.
This is the same question as this one but for deserialization instead.