DTOs in Play Framework

Viewed 14

i am trying to find a way to elegantly use DTOs (and validate them) in Play Framework

In spring you can just do

myControllerMethod(MyDto dto){ .... }

In play framework this doesn't seem possible. Do i really have to to Json.fromJson(request.body.asJson(), MyDto.class) and validate in every controller method? What if i want to validate, do i also have to inject the validator in every controller and do validator.validate() every time?

Using on java by the way, thanks

0 Answers
Related