Jackson default JsonView for Serialization
The view used for serialization can be set with the following code:
objectMapper.setConfig(objectMapper.getSerializationConfig().withView(DefaultView.class));
I ended up removing DefaultView. Any fields that belonged to a specialized view I continued to annotate with @JsonView(UserView.class/AdminView.class). Any fields I didn't ever want serialized I marked as @JsonIgnore.
I utilized the following ObjectMapper config to get my desired results:
@Providerpublic class JacksonContextResolver implements ContextResolver<ObjectMapper> { private final ObjectMapper objectMapper; public JacksonContextResolver() { objectMapper = new ObjectMapper(); objectMapper.setConfig(objectMapper.getSerializationConfig().withView(Object.class)); objectMapper.enable(MapperFeature.DEFAULT_VIEW_INCLUSION); } @Override public ObjectMapper getContext(Class<?> arg0) { return objectMapper; }}