fixed bug in REST module
This commit is contained in:
parent
919e1e3a30
commit
c2bfb4c0c6
1 changed files with 4 additions and 6 deletions
|
|
@ -16,16 +16,14 @@ class ActorComponentProvider(val clazz: Class[_], val configurators: List[Config
|
|||
|
||||
override def getScope = ComponentScope.Singleton
|
||||
|
||||
override def getInstance: Actor = {
|
||||
override def getInstance: AnyRef = {
|
||||
val instances = for {
|
||||
conf <- configurators
|
||||
if conf.isDefined(clazz)
|
||||
instance <- conf.getInstance(clazz)
|
||||
} yield instance
|
||||
instances match {
|
||||
case (instance : Actor) :: Nil => instance
|
||||
case Nil => throw new IllegalArgumentException("No Actor for class [" + clazz + "] could be found. Make sure you have defined and configured the class as an Active Object or Actor in a Configurator")
|
||||
case _ => throw new IllegalArgumentException("Actor for class [" + clazz + "] is defined in more than one Configurator. Eliminate the redundancy.")
|
||||
}
|
||||
if (instances.isEmpty) throw new IllegalArgumentException(
|
||||
"No Actor or Active Object for class [" + clazz + "] could be found.\nMake sure you have defined and configured the class as an Active Object or Actor in a supervisor hierarchy.")
|
||||
else instances.head.asInstanceOf[AnyRef]
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue