1

What is "this: Core =>" in CoreActors below.

import akka.actor.ActorSystem
import com.demo.service.DemoService
import com.typesafe.config.ConfigFactory

trait Core {
  implicit def system: ActorSystem
}

trait BootedCore extends Core {
  implicit lazy val system = ActorSystem("demo-microservice-system")

  sys.addShutdownHook(system.shutdown())
}

trait ConfigHolder {
  val config = ConfigFactory.load()
}

trait CoreActors extends ConfigHolder {
  this: Core =>

  val demoService = system.actorOf(
    DemoService.props("identity"), "DemoService")

  val services: Services = Map(
    "demoService" -> demoService
  )
}
Gabriele Petronella
  • 106,943
  • 21
  • 217
  • 235
Srini K
  • 3,315
  • 10
  • 37
  • 47
  • This is a self-type annotation, check http://stackoverflow.com/questions/1990948/what-is-the-difference-between-scala-self-types-and-trait-subclasses – edi Dec 18 '14 at 17:16
  • It's a core scala, not something from Akka, see also https://stackoverflow.com/questions/1990948/what-is-the-difference-between-scala-self-types-and-trait-subclasses?rq=1 – om-nom-nom Dec 18 '14 at 17:16

0 Answers0