Reputation: 34071
I would like to define two implicit parameters
in the apply method as the following:
object WsGraph {
def apply(logger: Logger, sink: Sink[Message, Future[Done]])
(implicit system: ActorSystem, implicit executor: ExecutionContextExecutor) {
}
}
But the compiler does not allow this. How to do it correctly?
Upvotes: 3
Views: 58
Reputation: 405
Multiple implicit parameters do not work. It should be like:
object WsGraph {
def apply(logger: Logger, sink: Sink[Message, Future[Done]])
(implicit system: ActorSystem, executor: ExecutionContextExecutor) {
}
}
Upvotes: 2
Reputation: 22595
You just need to add one keyword implicit
at the beginning of the second argument list and all arguments on it will be implicit:
object WsGraph {
def apply(logger: Logger, sink: Sink[Message, Future[Done]])
(implicit system: ActorSystem, executor: ExecutionContextExecutor) {
}
}
Upvotes: 5