public ApplicationContext getParentApplicationContext(RuntimeComponent component) {
ApplicationContext context = null;
Servlet servlet = component.getComponentContext().getCompositeContext().getAttribute(Servlet.class.getName());
if (servlet instanceof FrameworkServlet) {
FrameworkServlet frameworkServlet = (FrameworkServlet)servlet;
context = frameworkServlet.getWebApplicationContext();
if (context != null) {
log.info("Spring application context is found for servlet: " + frameworkServlet.getServletName());
return context;
}
}
ServletContext servletContext =
component.getComponentContext().getCompositeContext().getAttribute(ServletContext.class.getName());