Last active
May 11, 2018 18:39
-
-
Save alexandreaquiles/804d14d9f1668bda0cf3e30d49a9df7f to your computer and use it in GitHub Desktop.
Configurando o Jackson com o Spring pra só considerar os atributos. https://cursos.alura.com.br/forum/topico-spring-e-o-get-das-classes-seria-um-problema-61176
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
public class JacksonConfig { | |
@Bean | |
public ObjectMapper objectMapper() { | |
ObjectMapper mapper = new ObjectMapper(); | |
mapper.setVisibility(PropertyAccessor.GETTER, Visibility.NONE); | |
mapper.setVisibility(PropertyAccessor.SETTER, Visibility.NONE); | |
mapper.setVisibility(PropertyAccessor.CREATOR, Visibility.NONE); | |
mapper.setVisibility(PropertyAccessor.FIELD, Visibility.ANY); | |
return mapper; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment