I have a problem with serialization of "is getter" accessor to property name.
I have a class with boolean isState()
accessor method and property with name isState
.
During serialization I see that object mapper is convert isState()
method as state
property.
Of course I can use @JsonProperty
annotation but I need to do it generically for all such cases.
Before jackson-databind 2.12.0
it worked, unfortunately it stopped now because AccessorNamingStrategy
has been added with a new way to find field names for getters. I can extend the AccessorNamingStrategy
class and change the way to find field names, but it's too much code duplication to achieve such a minor goal. Issue: Extract getter/setter/field name mangling from 'BeanUtil' into pluggable 'AccessorNamingStrategy'
I tried to fight setAccessorNaming
because it came out from version 2.12.0 and setPropertyNamingStrategy
but unfortunately with poor results.
Edit:
I was able to fix the problem like this (image), if anyone has something better please let me know.
question from:
https://stackoverflow.com/questions/65876901/serialization-problem-with-is-getter-to-property-name-in-jackson-databind 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…