Is there some way how I can declare @JsonView
for whole Spring MVC rest controller?
I know I can declare @JsonView
for particular method like this:
@RequestMapping(value = "/user", method = RequestMethod.G
@JsonView(User.WithoutPasswordView.class)
public User getUser() {
return new User("eric", "7!jd#h23");
}
But I don't want to define @JsonView
per method because my methods are defined in supper class and I don't want to override them just to add single annotation.
I would like to declare @JsonView
for whole controller i.e. like this:
@RestController
@RequestMapping(ZONES_PATH)
@JsonView(User.WithoutPasswordView.class)
public class ZoneResource extends GenericRestService<Zone> {
...
Is there some way I can achieve this?