List of usage examples for org.springframework.boot.web.servlet ServletContextInitializer onStartup
void onStartup(ServletContext servletContext) throws ServletException;
From source file:org.springframework.boot.web.embedded.tomcat.TomcatStarter.java
@Override public void onStartup(Set<Class<?>> classes, ServletContext servletContext) throws ServletException { try {/* w w w . jav a 2 s.c om*/ for (ServletContextInitializer initializer : this.initializers) { initializer.onStartup(servletContext); } } catch (Exception ex) { this.startUpException = ex; // Prevent Tomcat from logging and re-throwing when we know we can // deal with it in the main thread, but log for information here. if (logger.isErrorEnabled()) { logger.error("Error starting Tomcat context. Exception: " + ex.getClass().getName() + ". Message: " + ex.getMessage()); } } }
From source file:org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.java
private void selfInitialize(ServletContext servletContext) throws ServletException { prepareWebApplicationContext(servletContext); ConfigurableListableBeanFactory beanFactory = getBeanFactory(); ExistingWebApplicationScopes existingScopes = new ExistingWebApplicationScopes(beanFactory); WebApplicationContextUtils.registerWebApplicationScopes(beanFactory, getServletContext()); existingScopes.restore();//from w ww .j ava2 s.com WebApplicationContextUtils.registerEnvironmentBeans(beanFactory, getServletContext()); for (ServletContextInitializer beans : getServletContextInitializerBeans()) { beans.onStartup(servletContext); } }