Path UUID Path - Play Framework

In my build.sbt I have

routesImport += "play.api.mvc.PathBindable.bindableUUID" 

And on my routes I:

 GET /groups/:id controllers.GroupController.get(id) 

And in my controller I have

 class GroupController { .... def get (id: UUID) 

I get the following error for the above route

 type mismatch; found : String required: java.util.UUID 

How can uuid be used in a path in a routes file in Play. I am using game 2.4.2 - scala 2.11.7

+4
source share
1 answer

A string is the default type for parameters in the routes file. To change this, you need to explicitly specify the type for Id:

 GET /groups/:id controllers.GroupController.get(id: java.util.UUID) 

If you do this, you will also find that you can also remove the bindableUUID import in the assembly file.

+10
source

All Articles