使用Jackson,可以轻松地为给定的 ObjectMapper
禁用所有注解。
有没有一种方法只禁用一个给定的注解?
// disable all
ObjectMapper mapper = new ObjectMapper()
mapper.disable(MapperFeature.USE_ANNOTATIONS);
// disable one?
ObjectMapper mapper = new ObjectMapper()
mapper.disable(@JsonIgnore);
使用@JacksonAnnotationsInside
,我定义了一个自定义的Jackson注释,并且我只想在特定情况下使用它。