I have the following REST endpoint:
@Stateless
@Path("test")
public class TestResource {
@POST
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public TestDTO test(TestDTO dto) {
return dto;
}
}
The TestDTO bean is really simple:
public class TestDTO {
private String id;
private Integer number;
// + getter/setter
}
If I post the following JSON, the response will be exactly the same (as expected in this trivial sample):
{
"id": "abc",
"number": 123
}
But if I send a string value for "number":
{
"id": "abc",
"number": "NotANumber"
}
the server will simply not initialize the number variable of my TestDTO (value = null) and my response will be the following:
{
"id": "abc"
}
I don't understand... why the server doesn't respond with a "400 - Bad request"? :/
This code is running in Weblogic application server version 12.2.1.1.0 with provided Jersey implementation (I only have one dependency in my pom.xml: javaee-api version 7.0)