我将一个 Akka
actor 添加到了我的应用中,该应用与 Spring
和 OSGI
兼容。
我试图像下面这样从 Spring @Component bean
中使用 Actor:
private final ActorSystem system = ActorSystem.create("actor-system");
private ActorRef managerActorRef = system.actorOf(Props.create(ManagerActor.class), "ldapManagerActor");
当我启动应用程序时,它会抛出一个异常(找不到键“akka”的配置设置
):
Instantiation of bean failed; nested exception is org.springframework.
beans.BeanInstantiationException: Could not instantiate bean class [com.myconpany....ByBean]: Constructor threw exception; nested exception is com.typesafe.config.ConfigException$Missing: No configuration setting found for key 'akka'
我看过了这个文档:doc。似乎我的问题根源与应该传递给/为
akka-system
和描述其内容的 application.conf
文件的 class loader
有关。
但到目前为止,我还没有找到合适的 stets
使其正常工作。
能有人帮忙吗?
我的尝试:
参考这篇文章。
当我输入:
<bean id="actorSystem" class="akka.actor.ActorSystem" factory-method="create" scope="singleton"></bean>
我有类似的错误:
Could not autowire field: private akka.actor.ActorSystem
com.typesafe.config.ConfigException$Missing: No configuration setting fou
nd for key 'akka'