有什么方法可以@JsonView
为整个 Spring MVC 休息控制器声明吗?
我知道我可以声明@JsonView
这样的特定方法:
@RequestMapping(value = "/user", method = RequestMethod.G
@JsonView(User.WithoutPasswordView.class)
public User getUser() {
return new User("eric", "7!jd#h23");
}
但我不想定义@JsonView
每个方法,因为我的方法是在超级类中定义的,我不想仅仅为了添加单个注释而重写它们。
我想@JsonView
为整个控制器声明,例如:
@RestController
@RequestMapping(ZONES_PATH)
@JsonView(User.WithoutPasswordView.class)
public class ZoneResource extends GenericRestService<Zone> {
...
有什么办法可以做到这一点吗?