Sharing ApplicationContext in Spring MVC and Non Spring MVC Portlet

In my project i had this interesting problem that i have one Portlet Application, which has 4 portlets now 3 of the portlets are using Spring MVC framework but the fourth portlet does not use Spring Portlet MVC framework instead it extends GenericPortlet. All my 4 portlets use same DAO and other classes and i am using Spring for wiring my DAOs

Problem was that how do i obtain ApplicationContext for the portlet that is not Spring Portlet MVC or how do i get access to ApplicationContext object.


PortletApplicationContextUtils.getWebApplicationContext(getPortletContext())


You can use PortletApplicationContextUtils.getWebApplicationContext() method, which is static method anywhere in your web application code to get access to ApplicationContext created by the ContextLoaderListener in your class.

2 comments:

Apollo Web Design said...

The blog was absolutely fantastic! Lot of great information which can be helpful in some or the other way. Keep updating the blog, looking forward for more contents...Great job, keep it up.. Web Design Company Bangalore | Ecommerce web development company

Abhi said...

Thanks for info....
SEO Company in Bangalore