我有以下conf文件:
connection.port = 8080
connection.interface = "127.0.0.1"
阅读此文件时,我正在尝试使用提炼和提炼的纯配置。我有以下课程:
import com.api.models.{Config, Connection}
import com.typesafe.config.ConfigFactory
import pureconfig.error.ConfigReaderFailures
import pureconfig.loadConfig
object Configuration {
val config = ConfigFactory.load()
val stuff: Either[ConfigReaderFailures, Connection] = loadConfig[Connection](config)
stuff match {
case Left(left) => println(left)
case Right(right) => println(right)
}
}
这是阅读以下案例类:
case class Connection(port: Int, interface: String)
但是,当我尝试编译它时,出现以下错误:
Error:(19, 79) could not find implicit value for parameter reader: pureconfig.Derivation[pureconfig.ConfigReader[com.api.models.Connection]]
val stuff: Either[ConfigReaderFailures, Connection] = loadConfig[Connection](config)
我真的不确定如何创建这样的隐含?