在我的build.sbt中我有
routesImport += "play.api.mvc.PathBindable.bindableUUID"
在我的路线中,我有:
GET /groups/:id controllers.GroupController.get(id)
在我的控制器中我有
class GroupController { ....
def get (id: UUID)
我收到上述路线的以下错误
type mismatch;
found : String
required: java.util.UUID
如何在Play中的路径文件中的路径中使用uuid。我正在使用play 2.4.2 - scala 2.11.7
答案 0 :(得分:14)
String是routes文件中参数的默认类型。要更改此设置,您需要明确指定Id的类型:
GET /groups/:id controllers.GroupController.get(id: java.util.UUID)
如果您这样做,您会发现您还可以删除构建文件中bindableUUID
的导入。