My spray json support looks like this
object MarshallingSupport extends SprayJsonSupport {
implicit def json4sFormats: Formats = DefaultFormats
}
And in my route I want to map the request to a dto
object Main extends App with AppConfig with BaseService with MainActorSystem {
val processor = system.actorOf(Props(), "processorActor")
val view = system.actorOf(Props(), "processorActor")
override protected implicit val executor: ExecutionContext = system.dispatcher
override protected val log: LoggingAdapter = Logging(system, getClass)
override protected implicit val materializer: ActorMaterializer = ActorMaterializer()
Http().bindAndHandle(routes(processor, view), httpInterface, httpPort)
}
trait BaseServiceRoute {
protected implicit def executor: ExecutionContext
protected implicit def materializer: ActorMaterializer
protected def log: LoggingAdapter
}
trait MainActorSystem {
implicit val system = ActorSystem("booking")
}
final case class CalculatePriceForRangeDto(unitId: Int, from: Long, to: Long)
trait PriceServiceRoute extends BaseServiceRoute {
implicit val timeout = Timeout(30 seconds)
import com.example.crudapi.utils.MarshallingSupport._
def customersRoute(command: ActorRef, query: ActorRef) = pathPrefix("price") {
post {
path("calculate") {
decodeRequest {
entity(as[CalculatePriceForRangeDto]) {
priceForRange => onComplete((query ? CalculatePriceForRange(
but I'm getting
Error:(32, 20) could not find implicit value for parameter um: akka.http.scaladsl.unmarshalling.FromRequestUnmarshaller[com.example.crudapi.http.routes.CalculatePriceForRangeDto]
entity(as[CalculatePriceForRangeDto]) {
^
Have seen all related SO questions but nothing solved my issue. Strange part is that I tried Typesafe template akka-dddd-cqrs and it works, same code.
Am I missing something with implicit context? Any ideas of what could it be?