But here I want to add one thing is how to access the application context?
One way is you can get the context from below method return:
ConfigurableApplicationContext applicationContext = app.run(args);
Another is if you deploy the .war to external Tomcat server, the applicationContext may be null, in this case, you can get it from onStartup() method
@Overridepublic void onStartup(ServletContext servletContext) throws ServletException { WebApplicationContext rootAppContext = createRootApplicationContext(servletContext); if (rootAppContext != null) {
// set context into your own class, say MySpringContext here MySpringContext.setContext(rootAppContext); servletContext.addListener(new ContextLoaderListener(rootAppContext) { @Override public void contextInitialized(ServletContextEvent event) { // no-op because the application context is already initialized } }); } else { this.logger.debug("No ContextLoaderListener registered, as " + "createRootApplicationContext() did not " + "return an application context"); } }
Great post! I am actually getting ready to across this information, It’s very helpful for this blog
ReplyDeleteBest Salesforce Admin training in Coimbatore | Salesforce Admin training in Coimbatore | Best Salesforce Admin training institute in Coimbatore | Salesforce Admin Course in Coimbatore | Best Salesforce Admin training in Saravanampatti
I am very happy to share this amazing testimony Dr.Oje Abacha herbs help me to cure my Herpes Simplex Disease and i was haven this Herpes 3 months ago.. i had unprotected sex with a man i met and he did tell me he had Herpes disease after some weeks later i started seeing bump and sore on my vaginal, and i was so scared so i went to my doctor and did some test and behold i was confirmed Herpes positive, i went home so confused and frustrated about this, especially when i was told there was no permanent cure for it, i said to myself i need to research about this, maybe there might be a herbal help for me, and so i did and when i was researching about herbal herbs, i keep seeing Dr.Oje Abacha on every blog and guestbook, so i immediately wrote to Dr.Oje Abacha, after we discuss he prepared my medicine and sent it to me, within few days i received my medicine and started applying it as instructed within 2weeks Dr.Oje Abacha told me to go for check up, and i did, shocking my result came out negative, i am so happy thanks to you sir,
ReplyDeletecontact his email address,
oje.herbalsolutioncentre@gmail.com
more information WhatsApp Number : +2349050957732
by Dr.Oje Abacha website
https://ojeherbalsolutioncentre.wordpress.com