Injecting values to controller arguments #11426
GithubUser8080
started this conversation in
General
Replies: 1 comment 2 replies
-
Authentication using PlayFramework can do using ActionFilter on Scala to avoid copy and paste. https://www.playframework.com/documentation/2.8.x/ScalaActionsComposition#Validating-requests I don't use the Play Framework with Java, the use of custom actions may be a solution. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hi, we are trying to emulate some of Springs features like automatic dto (or other value) injection in controller methods, validation, and security filtering.
E.g
myControllerMethod(User currentUser, @Valid Product productDto);
The only interface i can see that provides a mechanism for controller value injection is QueryStringBindable and PathBindable. However, user is not based on the query string or path, but a header token, and the dto comes from the body. Is there any plan to enhance this functionality? Because at the moment you have to add the json parsing, dto validation, and authentication, like the example in every controller method. I would like to centralize this and not copy paste it tens of times. Would that be possible? Thanks
Beta Was this translation helpful? Give feedback.
All reactions