Closed
Description
David Harrigan opened SPR-12552 and commented
Hi,
Spring 4.1.3
Jackson 2.4.4
I have a class that looks something like this:
public class Foo {
public interface Summary{}
@JsonView(Foo.Summary.class)
private String name;
private String password;
}
and a controller that looks something like this:
@JsonView(Foo.Summary.class)
public ResponseEntity<PagedResources<Resource<Foo>>> getFoos() {
final Page<Foo> foos = serviceLayer.getFoos();
return new ResponseEntity<>(pagedResourcesAssember.toResource(foos), HttpStatus.OK);
}
However, when I get the values returned, they include everything:
{
"links": {
.....
.....
},
"content" : [
{
"name": "billy",
"password": "sssh"
},
{
"name": "goat",
"password": "drowssap"
}
],
"pages": {
....
....
}
}
As you can see, the @JsonView
is not being honoured during the serialization of the Content data as the "password" field is being included in the serialization.
Thank you.
-=david=-
Affects: 4.1.3