0

当您的服务器添加了新的响应字段时,如果我们不让 scalaxb 知道忽略未知字段,例如 jackson 中的 @JsonIgnore,您的客户端将失败。

4

1 回答 1

0

为此,它有一个非常好的解决方案。只需在 build.sbt 的构建工具示例代码中添加 scalaxbIgnoreUnknown in (Compile, scalaxb) := true

```lazy val helloModule = (project in file(".")).settings(
commonSettings,
publishSetting,
scalaxbIgnoreUnknown in (Compile, scalaxb) := true,
scalaxbDispatchVersion in (Compile, scalaxb) := vDispatch,
scalaxbPackageName in (Compile, scalaxb)     := "com.hello.helloModule.client",
libraryDependencies := Seq(
      "org.scala-lang.modules" %% "scala-parser-combinators" % "1.0.4",
      "org.scala-lang.modules" %% "scala-swing" % "2.0.0-M2",


      "net.databinder.dispatch" %% "dispatch-core" % vDispatch,
      "com.typesafe" % "config" % "1.3.1",
  "org.scala-lang.modules" %% "scala-xml" % "1.1.0"
    ),
name := "com.hello.helloModule.client").enablePlugins(ScalaxbPlugin)```
于 2019-02-22T04:50:00.213 回答