I have a bean that implements the ServletContextAware and BeanFactoryPostProcessor interfaces. I need this bean register in applicationContext after the completion of ServletContext initialization, because I use some parameters in servletContext to initialize this bean.
I am using Spring Boot, the bean name is SpringBeanProcessorServletAware. I will add it to the bean configuration.
@Bean
public static SpringBeanProcessorServletAware springBeanProcessor() {
SpringBeanProcessorServletAware p = new SpringBeanProcessorServletAware();
return p;
}
My problem is that a bean is created before my container has installed servletContext in it . Then I can not get the parameters from servletContext . How to control that a bean should be created after servletContext is fully created
source
share