Hi, Please check if IgniteSpringBean will help in your case.
Kind regards, Alex. On Mon, Jul 10, 2017 at 5:52 PM, Humphrey [via Apache Ignite Users] < [email protected]> wrote: > Hello, > > Here [1] there is an explanation how to startup Ignite in an WAR (Spring > MVC) file using the web.xml. > > <listener> > > <listener-class>org.apache.ignite.startup.servlet.ServletContextListenerStartup</listener-class> > </listener> > > <context-param> > <param-name>IgniteConfigurationFilePath</param-name> > <param-value>config/default-config.xml </param-value> > </context-param> > > > I managed to get it started with the following code: > > @Override > public void onStartup(ServletContext servletContext) throws > ServletException { > > servletContext.addListener(ServletContextListenerStartup.class); > > servletContext.setInitParameter(ServletContextListenerStartup.IGNITE_CFG_FILE_PATH_PARAM, > "config/default-config.xml"); > > super.onStartup(servletContext); > } > > > I would like to have Ignite started programmatically, without having a > spring based configuration file "config/default-config.xml" file, but by > specifying a IgniteConfiguration and CacheConfiguration in Java Code. > > I tried to have it started with the following but it's not getting > started: > > @Configuration > @EnableWebMvc > @ComponentScan(basePackages = {"mypackage"}) > > public class AppConfig { > > @Bean > public Ignite igniteInstance() { > IgniteConfiguration cfg = new IgniteConfiguration(); > cfg.setClientMode(true); > cfg.setPeerClassLoadingEnabled(true); > return Ignition.start(cfg); > } > .... > > > Is it possible to start Ignite programmatically when the WAR is starting > up (by loading that bean)? > > [1] https://apacheignite-mix.readme.io/v1.9/docs/web-session-clustering# > configuration > > ------------------------------ > If you reply to this email, your message will be added to the discussion > below: > http://apache-ignite-users.70518.x6.nabble.com/Using- > AbstractAnnotationConfigDispatcherServletInitializer-tp14592.html > To start a new topic under Apache Ignite Users, email > [email protected] > To unsubscribe from Apache Ignite Users, click here > <http://apache-ignite-users.70518.x6.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=1&code=YWxleGFuZGVyLmZlZG90b2ZmQGdtYWlsLmNvbXwxfC0xMzYxNTU0NTg=> > . > NAML > <http://apache-ignite-users.70518.x6.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> > -- View this message in context: http://apache-ignite-users.70518.x6.nabble.com/Using-AbstractAnnotationConfigDispatcherServletInitializer-tp14592p14594.html Sent from the Apache Ignite Users mailing list archive at Nabble.com.
