I have an Entity with @JsonView annotation:
@JsonView(View.Secure.class)
private String password;
Inside my controller:
@RequestMapping(method = RequestMethod.GET, produces = "application/json")
@JsonView(View.Secure.class)
public ResponseEntity<?> getAllUsers(){
return createUserListResponse();
}
My View class:
public class View {
public static class Secure {}
}
I've expected that response will contain only "password" field, but instead it contains nothing. When i remove annotation @JsonView(View.Secure.class)
from Controller - it works as usual and returns all fields. What am i doing wrong? Is it required to add some additional configuration into Spring config?
I used this tutorial: http://ift.tt/11QwK3H
Aucun commentaire:
Enregistrer un commentaire