I am interested in injecting Actors to beans, while the actors will be created by spring. In addition, I am looking for ways to customize Akka configuration file path.
My project uses Java 7 and spring 3.2.5, akka version is 2.3.7.
I read some documents and guides that instruct to create a bean definition in my spring beans configuration file, as follows:
<bean id="system-actor" class="akka.actor.ActorSystem" factory-method="create" destroy-method="shutdown" scope="singleton">
<constructor-arg value="MyApp" />
</bean>
The system actor created by spring successfully according to default configuration. Questions:
I want to initialize the system actor according to /WEB-INF/application.conf file, I added the -Dconfig.trace=loads system property in order to debug configuration loading, this is the output:
Loading config from class loader WebappClassLoader context: /MY-APP delegate: false repositories: /WEB-INF/classes/ ----------> Parent Classloader: org.apache.catalina.loader.StandardClassLoader@992f73 but there were no resources called application.conf exception loading application.conf: java.io.IOException: resource not found on classpath: application.conf Loading config from class loader WebappClassLoader context: /MY-APP delegate: false repositories: /WEB-INF/classes/ ----------> Parent Classloader: org.apache.catalina.loader.StandardClassLoader@992f73 but there were no resources called application.json exception loading application.json: java.io.IOException: resource not found on classpath: application.json Loading config from class loader WebappClassLoader context: /MY-APP delegate: false repositories: /WEB-INF/classes/ ----------> Parent Classloader: org.apache.catalina.loader.StandardClassLoader@992f73 but there were no resources called application.properties exception loading application.properties: java.io.IOException: resource not found on classpath: application.properties Did not find 'application' with any extension (.conf, .json, .properties); but 'application' is allowed to be missing. Exceptions from load attempts should have been logged above. Loading config from URL jar:file:/var/work/MY-APP/jakarta-tomcat/webapps/MY-APP/WEB-INF/lib/akka-actor_2.10-2.3.7.jar!/reference.conf from class loader WebappClassLoader context: /MY-APP delegate: false repositories: /WEB-INF/classes/ ----------> Parent Classloader: org.apache.catalina.loader.StandardClassLoader@992f73
Is there a way to pass this path to system actor bean?
There is a way to create actor beans in spring instead of injecting the system actor and using
system.actorOf(Props.create(MyActor.class), "name");
? Detailed examples will be helpful.- Many answers to simillar issues point to this article: http://blog.nemccarthy.me/?p=272 but this page is offline, someone knows what's written there?