In order to integrate a custom ObjectMapper (as defined
https://www.playframework.com/documentation/2.4.x/JavaJsonActions#Advanced-usage), the old way was to configure it in Global.onStart(). As far as I can tell, the new way is to inject the custom ObjectMapper as a dependency.
Does that mean that I create a new java class, something like this..
public class CustomObjectMapper{
public
CustomObjectMapper() {
ObjectMapper mapper = new ObjectMapper()
// enable features and customize the object mapper here ...
.enable(DeserializationFeature.USE_BIG_DECIMAL_FOR_FLOATS)
.disable(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES);
// etc.
Json.setObjectMapper(mapper);
}
}
The part I have trouble understanding is, how will this get injected? Where would I use the @inject syntax, if that is the correct method of injecting it.