惰性 val productService = BeanLookup[ProductDataService]
object BeanLookup {
def apply[T](implicit manifest: Manifest[T], context: ActorContext) = {
val beanLookup =
context.actorFor("/user/spring/beanLookup")
Await.result(
(beanLookup.ask(LookupBean(manifest.erasure))(timeout)).mapTo[T](manifest),
timeout.duration) }
def apply[T](implicit manifest: Manifest[T], system: ActorSystem) = {
val beanLookup =
system.actorFor("/user/spring/beanLookup")
Await.result(
(beanLookup.ask(LookupBean(manifest.erasure))(timeout)).mapTo[T](manifest),
timeout.duration) } }
斯卡拉克抱怨:
scala: ambiguous reference to overloaded definition,
both method apply in object BeanLookup of type (implicit manifest: Manifest[com.tooe.core.service.LocationCategoryDataService], implicit system: akka.actor.ActorSystem)com.tooe.core.service.LocationCategoryDataService
and method apply in object BeanLookup of type (implicit manifest: Manifest[com.tooe.core.service.LocationCategoryDataService], implicit context: akka.actor.ActorContext)com.tooe.core.service.LocationCategoryDataService