我正在将 Play 2.8.8 项目从 Scala 2.12 迁移到 2.13。
我在 Play routes 文件中有一个非常奇怪的错误:
Either 类中的右方法已弃用(自 2.13.0 起):Either 现在是右偏的,直接在 Either 上使用方法
路由文件、生成的 Scala 路由文件或相关 Controller 中没有 .right
调用。
路由文件:
POST /roles/:id controllers.Authentication.api.RolesResource.addRoleToAccount(id:models.users.AccountId)
DELETE /roles/:id controllers.Authentication.api.RolesResource.removeRoleFromAccount(id:models.users.AccountId)
GET /roles/:id controllers.Authentication.api.RolesResource.getRolesForAccount(id:models.users.AccountId)
感谢您提供此错误可能来源的任何指导。
最佳答案
我认为原因在 play.core.routing.GeneratedRouter
类中。
从我的路由文件这个方法:
(for {
a1 <- pa1.value.right
a2 <- pa2.value.right}
yield (a1, a2))
.fold(badRequest, { case (a1, a2) => generator(a1, a2) })
}
它包含对已弃用的 .right
函数的调用。
关于Scala 2.13 迁移,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68488907/