Closed
Description
We have a large web application that uses Jackson annotated pojos to marshal and unmarshal data on REST routes. After upgrading from 2.8.11 to 2.9.4, several of our REST routes are no longer working. There is either data missing from GETs or not getting processed from POSTs/PUTs. I have reproduced this with a test class highlighted below, demonstrating a simple scenario with an IS getter method vs a GET method, but there are other cases as well. This is preventing us from upgrading to 2.9.
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import javax.ws.rs.container.AsyncResponse;
import javax.ws.rs.container.Suspended;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import org.springframework.stereotype.Controller;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
@Controller
@Path("/diagnostics")
public class JacksonTestController
{
public JacksonTestController()
{
}
@JsonAutoDetect(setterVisibility = JsonAutoDetect.Visibility.NONE, getterVisibility = JsonAutoDetect.Visibility.ANY)
public class JacksonTestPOJO
{
public JacksonTestPOJO()
{
}
private boolean booleanProperty1;
private boolean booleanProperty2;
public void setBooleanProperty1(boolean value)
{
this.booleanProperty1 = value;
}
public boolean isBooleanProperty1()
{
return booleanProperty1;
}
public void setBooleanProperty2(boolean value)
{
this.booleanProperty2 = value;
}
public boolean getBooleanProperty2()
{
return booleanProperty2;
}
}
@GET
@Path("/jacksonTest")
@Produces(MediaType.APPLICATION_JSON)
public void get(@Suspended final AsyncResponse asyncResponse)
{
JacksonTestPOJO view = new JacksonTestPOJO();
view.setBooleanProperty1(true);
view.setBooleanProperty2(true);
asyncResponse.resume(Response.ok(view).build());
}
// Jackson 2.8.11 returns:
// {
// "booleanProperty1" : true
// "booleanProperty2" : true
// }
// Jackson 2.9.4 returns:
// {
// "booleanProperty2" : true
// }
}
Metadata
Metadata
Assignees
Labels
No labels