1
我有以下情况下类:找不到隐格式参数
case class Customer(name: String)
也可以像这样编码:
class ServiceJsonProtocol extends DefaultJsonProtocol {
implicit val customerProtocol = jsonFormat1(Customer)
}
的问题是,这种代码:
val route =
path("customer") {
post {
entity(as[Customer]) {
customer => complete {
customers.add(customer)
s"got customer with name ${customer.name}"
}
}
}
我得到这个:
could not find implicit value for parameter um: akka.http.scaladsl.unmarshalling.FromRequestUnmarshaller[Customer]
[error] entity(as[Customer]) {
问题是什么?
如果您使用'spray-json',请在您的问题中提及它。另外,看看http://stackoverflow.com/questions/33574176/akka-http-could-not-find-implicit-value-for-parameter-unmarshalling – YoungSpice