How to read a data object via a factory method from the JSON body in a REST request in JAX-RS?
In a Java REST service using JAX-RS (Jersey 3.1.1, Jackson 2.14.2), I have an immutable data object, say: public class MyDataObj { private int a; public static MyDataObj valueOf(String jsonStr) { return new MyDataObj(new ObjectMapper().readTree(jsonStr).get("a").asInt()); } public MyDataObj(int a) {…