我有一个带有spring mvc的项目,我想调用方法" setIgnorableProperties"从MapDeserializer全局,但我不知道如何从ObjectMapper获取此类,你能帮助我吗?感谢您的建议。 我看到了,就像那样:
@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 I have to invoke?) ;
mapDes.setIgnorableProperties({"@id", "@ref"});
}
});
}
答案 0 :(得分:1)
该属性不是直接配置的;您需要对from cycler import cycler
my_cycle = (cycler('lw', [1, 3] *
cycler('color', ['b', 'g', 'r', 'c', 'm', 'y', 'k']))
fig, ax = plt.subplots()
for sty, data in zip(my_cycle(), my_data):
ax.plot(x, data, **sty)
- 值属性使用@JsonIgnoreProperties
注释。
如果需要,您可以通过以下方式创建便利注释:
Map
然后使用like:
@Retention(RetentionPolicy.RUNTIME) // IMPORTANT
@JacksonAnnotationsInside
@JsonIgnoreProperties({ "@id", "@ref" })
public @interface MapIgnorals