在我的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如何使用uuid在路径中的路由文件中发挥作用。我使用的是play 2.4.2 - scala 2.11.7
发布于 2015-07-28 07:22:21
字符串是路由文件中参数的默认类型。要更改这一点,需要显式地为Id指定一个类型:
GET /groups/:id controllers.GroupController.get(id: java.util.UUID)如果这样做,您还可以在构建文件中删除bindableUUID的导入。
https://stackoverflow.com/questions/31669106
复制相似问题