public class IocInitializeListener implements ServletContextListener {
@Override
public void contextInitialized(ServletContextEvent servletContextEvent) {
WebApplicationContext applicationContext = WebApplicationContextUtils.
getRequiredWebApplicationContext(servletContextEvent.getServletContext());
SpringInstanceProvider springProvider = new SpringInstanceProvider(applicationContext);
InstanceFactory.setInstanceProvider(springProvider);
}