0

I want jackson to stop serializing fields that aren't fields, for example isNew(), which is just a method. So I've added this.

@Configuration
class JacksonConfig extends RepositoryRestConfigurerAdapter {

    @Override
    public void configureJacksonObjectMapper(ObjectMapper objectMapper) {
        objectMapper.setVisibility( PropertyAccessor.IS_GETTER, JsonAutoDetect.Visibility.NONE );
    }
}

however recently it seems that if I touch anything with Spring Boot something else breaks (e.g. I disabled getters and hateos stopped working).

Does this have any negative consequences that I haven't encountered yet?

xenoterracide
  • 16,274
  • 24
  • 118
  • 243
  • Part of your question is similar to: http://stackoverflow.com/questions/22495838/how-to-ignore-is-methods-with-jackson-2-2-3 – ebullient Aug 18 '16 at 00:01
  • @ebullient yeah not the same thing though, the ignore is actually working, I'm just trying to see if doing this is secretly disabling HEAD or something like that. Some massive unintended consequence. – xenoterracide Aug 18 '16 at 00:05
  • That's what I thought, but I wanted to ask. The linked answer is a more precise way of disabling detection of the getter. The above feels to me like hitting a nail with a sledgehammer. :-P Curious if the annotation on the class has the same effects as altering the configuration of the objectmapper – ebullient Aug 18 '16 at 00:15
  • ebullent well the problem is that every entity (the things that I'm serializing) will have an `isNew` that is not actually a property. – xenoterracide Aug 18 '16 at 00:22
  • And you can't target those methods explicitly because ...? – a better oliver Aug 18 '16 at 07:09

0 Answers0