How to Access Spring Application Context from JSR-168 Portlet
Step 1 :
Make sure you have spring-webmvc-portlet.jar in your project classpath
Step 2 :
Make sure you defined your spring files in web.xml like this
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:applicationContext-dao.xml
classpath:applicationContext-services.xml
classpath:applicationContext-schedule.xml
classpath:applicationContext-ajax.xml
</param-value>
</context-param>
Optional
<servlet>
<servlet-name>context</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
Step 3 :
Access like this.
PortletContext pc = this.getPortletContext();
ApplicationContext context = PortletApplicationContextUtils.getWebApplicationContext(pc);
SessionConfigure sessionConfigure = (SessionConfigure) context.getBean("sessionConfigure");
Comments