1

在我的 app.config 文件中有一个属性,如:

enable-toggle-prop {
   update-toggle-enabled=false
}

我正在解析的文件如下所示:

import pureconfig._
import pureconfig.generic.auto._

case class MyConfig(updateToggleEnabled: Boolean)
object MyConfig {
    val config: MyConfig = {
        val parseConfig = ConfigSource.default.at("enable-toggle-prop").load[MyConfig]
    config match {
       case Left(error) => //Throwing Illegal Argument exception
       case Right(parsedConf) => parsedConf
    }
}

当我尝试部署应用程序时遇到 IllegalArgumentException 说“配置无效:ConfigReaderFailure(CovertFailure(WrongType(String, Set(Boolean))))...”为什么它不能转换布尔值?我在这里有什么遗漏吗?TIA

4

0 回答 0