java - Configure build-in the Jackson MapDeserializer -
i have project spring mvc , wanna invoke method "setignorableproperties" mapdeserializer globally, dont know how class objectmapper, can me? thx advice. see it, that:
@override public void extendmessageconverters(list<httpmessageconverter<?>> converters) { mapdeserializer.getcontenttype(); converters.foreach(httpmessageconverter -> { if (httpmessageconverter instanceof mappingjackson2httpmessageconverter) { mappingjackson2httpmessageconverter converter = (mappingjackson2httpmessageconverter) httpmessageconverter; objectmapper mapper = converter.getobjectmapper(); mapdeserializer mapdes = mapper.(what have invoke?) ; mapdes.setignorableproperties({"@id", "@ref"}); } }); }
that property not meant configured directly; need use @jsonignoreproperties
annotation map
-valued properties. can create convenience annotation, if want, by:
@retention(retentionpolicy.runtime) // important @jacksonannotationsinside @jsonignoreproperties({ "@id", "@ref" }) public @interface mapignorals
and use like:
public class stuff { @mapignorals public map<string,object> values; }
Comments
Post a Comment