/** * Returns the {@link ServletContext} to be injected or {@code null}. This method * can be overridden by subclasses when a context is obtained after the post-processor * has been registered. */ @Nullable protected ServletContext getServletContext() { if (this.servletContext == null && getServletConfig() != null) { return getServletConfig().getServletContext(); } return this.servletContext; }
/** * Returns the {@link ServletContext} to be injected or {@code null}. This method * can be overridden by subclasses when a context is obtained after the post-processor * has been registered. */ @Nullable protected ServletContext getServletContext() { if (this.servletContext == null && getServletConfig() != null) { return getServletConfig().getServletContext(); } return this.servletContext; }
@Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { if (getServletContext() != null && bean instanceof ServletContextAware) { ((ServletContextAware) bean).setServletContext(getServletContext()); } if (getServletConfig() != null && bean instanceof ServletConfigAware) { ((ServletConfigAware) bean).setServletConfig(getServletConfig()); } return bean; }
@Override protected ServletConfig getServletConfig() { ServletConfig servletConfig = this.webApplicationContext.getServletConfig(); return (servletConfig != null) ? servletConfig : super.getServletConfig(); }
@Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { if (getServletContext() != null && bean instanceof ServletContextAware) { ((ServletContextAware) bean).setServletContext(getServletContext()); } if (getServletConfig() != null && bean instanceof ServletConfigAware) { ((ServletConfigAware) bean).setServletConfig(getServletConfig()); } return bean; }
/** * Returns the {@link ServletContext} to be injected or {@code null}. This method * can be overridden by subclasses when a context is obtained after the post-processor * has been registered. */ @Nullable protected ServletContext getServletContext() { if (this.servletContext == null && getServletConfig() != null) { return getServletConfig().getServletContext(); } return this.servletContext; }
/** * Returns the {@link ServletContext} to be injected or {@code null}. This method * can be overridden by subclasses when a context is obtained after the post-processor * has been registered. */ @Nullable protected ServletContext getServletContext() { if (this.servletContext == null && getServletConfig() != null) { return getServletConfig().getServletContext(); } return this.servletContext; }
@Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { if (getServletContext() != null && bean instanceof ServletContextAware) { ((ServletContextAware) bean).setServletContext(getServletContext()); } if (getServletConfig() != null && bean instanceof ServletConfigAware) { ((ServletConfigAware) bean).setServletConfig(getServletConfig()); } return bean; }
@Override public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { if (getServletContext() != null && bean instanceof ServletContextAware) { ((ServletContextAware) bean).setServletContext(getServletContext()); } if (getServletConfig() != null && bean instanceof ServletConfigAware) { ((ServletConfigAware) bean).setServletConfig(getServletConfig()); } return bean; }