/** * Sets the {@code ServletContext}. * * @param servletContext the servlet context, not null */ @Override public void setServletContext(final ServletContext servletContext) { servletContext.setAttribute(SERVLET_CONTEXT_KEY, this); for (final ServletContextAware obj : _servletContextAware) { obj.setServletContext(servletContext); } }
public Object postProcessBeforeInitialization(Object bean, String name) throws BeansException { if (bean instanceof ServletContextAware) { if (logger.isDebugEnabled()) { logger.debug("Invoking setServletContext on ServletContextAware bean '" + name + "'"); } ((ServletContextAware) bean).setServletContext(this.servletContext); } return bean; }