После обновления play-json до 2.7.0 я столкнулся с ошибкой во время выполнения:
[info] com.mycompany.controllers.HealthControllerSpec *** ABORTED ***
[info] java.lang.NoSuchMethodError: play.api.libs.json.JsonConfiguration$.apply$default$2()Lplay/api/libs/json/OptionHandlers;
[info] at com.mycompany.util.json.SnakeCase.$init$(SnakeCase.scala:41)
[info] at com.mycompany.util.playframework.controllers.HealthView$.<init>(HealthView.scala:15)
[info] at com.mycompany.util.playframework.controllers.HealthView$.<clinit>(HealthView.scala)
[info] at com.mycompany.util.playframework.controllers.HealthController.<init>(HealthController.scala:25)
[info] at com.mycompany.util.playframework.controllers.HealthControllerSpec.$anonfun$new$2(HealthControllerSpec.scala:30)
[info] at org.scalatest.OutcomeOf.outcomeOf(OutcomeOf.scala:85)
[info] at org.scalatest.OutcomeOf.outcomeOf$(OutcomeOf.scala:83)
[info] at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
[info] at org.scalatest.Transformer.apply(Transformer.scala:22)
[info] at org.scalatest.Transformer.apply(Transformer.scala:20)
Может кто-нибудь указать мне на причину?
HealthView
:
case class HealthView(app: String, description: String, version: Option[String])
object HealthView extends SnakeCase {
def apply(config: Configuration): HealthView =
HealthView(
config.get[String]("app.name"),
config.get[String]("app.description"),
config.getOptional[String]("app.version")
)
implicit val format: OFormat[HealthView] = Json.format[HealthView]
}
SnakeCase
:
trait SnakeCase {
implicit val jsonConfig: Aux[Json.MacroOptions] = JsonConfiguration(SnakeCaseNaming)
}
Релиз с младшей версией должен быть двоично-совместимым.