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

Popular posts from this blog

Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.12:test (default-test) on project.Error occurred in starting fork -

windows - Debug iNetMgr.exe unhandle exception System.Management.Automation.CmdletInvocationException -

configurationsection - activeMq-5.13.3 setup configurations for wildfly 10.0.0 -