You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ignite.apache.org by "kcheng.mvp" <kc...@gmail.com> on 2015/08/13 08:01:53 UTC
How to get Spring context
Ignition starts with a spring configuration file, is there anyway(static
method) to get the spring context?
--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-get-Spring-context-tp943.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.
Re: How to get Spring context
Posted by "kcheng.mvp" <kc...@gmail.com>.
Yes, that's what am doing right now!
--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-get-Spring-context-tp943p976.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.
Re: How to get Spring context
Posted by vkulichenko <va...@gmail.com>.
It looks like we don't have such a method, but I think it's a good idea to
have it. I created a ticket:
https://issues.apache.org/jira/browse/IGNITE-1248
As an alternative, you can use Ignition.loadSpringBean(..) method. It will
load the context from scratch and retrieve the bean by name. Will this work
for you?
-Val
--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-get-Spring-context-tp943p975.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.
Re: How to get Spring context
Posted by "kcheng.mvp" <kc...@gmail.com>.
My scenario is bit difference with this. i define a some none-ignite related
bean/service in the xml configuration. as ignite starts with this xml file,
so I guess there might be a xxxContext to get a ignite reference.
--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-get-Spring-context-tp943p972.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.
Re: How to get Spring context
Posted by vkulichenko <va...@gmail.com>.
You can use @IgniteSpringApplicationContextResource annotation to inject app
context into tasks, jobs, closures, entry processor and other entities. For
example:
private static class MyRunnable implements IgniteRunnable {
@SpringApplicationContextResource
private ApplicationContext appCtx;
@Override public void run() {
// TODO
}
}
Will this work for you?
-Val
--
View this message in context: http://apache-ignite-users.70518.x6.nabble.com/How-to-get-Spring-context-tp943p961.html
Sent from the Apache Ignite Users mailing list archive at Nabble.com.