gpt4 book ai didi

spring - 将 Akka 与 Spring 和 OSGI 集成(未找到 key 'akka' 的配置设置)

转载 作者:行者123 更新时间:2023-12-01 05:21:00 25 4
gpt4 key购买 nike

我添加了一个 Akka Actor 到我的应用程序 SpringOSGI .

我尝试使用来自 Spring @Component bean 的 Actor像这样:

private final ActorSystem system = ActorSystem.create("actor-system");
private ActorRef managerActorRef = system.actorOf(Props.create(ManagerActor.class), "ldapManagerActor");

当我启动应用程序时,它会引发异常( No configuration setting found for key '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'

我看过 this : 医生。似乎我的问题的根源与 class loader 有关我应该传递给/为 akka-systemapplication.conf描述这一点的文件。

但是我找不到合适的 stets到目前为止,一切顺利。

有人可以帮忙吗?

我的尝试:

流动 this文章。

当我把:
<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'

最佳答案

如果您只想使用 Akka actor,则无需传入 application.conf 设置。您可以只使用默认值。确保您的类路径上有配置库。

您没有提到您使用的是哪个版本的 Akka,但是如果您获取最新的 Akka 2.2 RC,您可以使用 IndirectActorProducer 来处理 Spring 接线。

请参阅这篇文章了解如何做到这一点; http://blog.nemccarthy.me/?p=272

您还应该告诉 Spring 在 ActorSystem 上调用 shutdown 以彻底关闭。还有一个关于如何将 ActorSystem 集成到 Spring 或 Web 应用程序中的更新指南 here

关于spring - 将 Akka 与 Spring 和 OSGI 集成(未找到 key 'akka' 的配置设置),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16698499/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com