@JsonView 實現把重要字段不展示給用戶,(實現對用戶展示字段的控制)
1.使用接口來聲明多個視圖
2.在值對象的get方法上指定視圖(
3.在controller方法上指定視圖
然後我在id,username添加上@JsonView(UserSimpleView.class),其下是我的返回結果
如果想了解springboot模擬mvc對controller進行測試請查看https://blog.csdn.net/qq_37978449/article/details/81540436