You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
spring-boot/spring-boot-autoconfigure
Andy Wilkinson e57b0e00f2 Use ServletContainerInitializers to start servers
The Servlet spec prohibits ServletContextListeners from being registered
programatically other than from with a call to
`ServletContainerInitializer.onStartup`. This restriction is not
consistently enforced by the various embedded servlet containers that
Boot supports:

- Jetty 8 does not enforce the restriction.
- Jetty 9 enforces the restriction. We were working around it be calling
  setExendedListenerTypes(true) on the context.
- Tomcat somewhat enforces the restriction: it doesn't allow a
  ServletContextListener to be added once the first
  ServletContextListener has been called. We were using a
  LifecycleListener to drive the ServletContextListeners.
- Undertow enforces the restriction and we were not working around it.
  This resulted in gh-2192 being raised.

ServletListenerRegistrationBean is a ServletContextListener and is used
to register listeners, including ServletContextListeners, with the
servlet context. To adhere to the letter of the servlet spec this means
that ServletListenerRegistrationBeans need to be called from with
ServletContainerInitializer.onStartup. This commit updates all of the
embedded servlet container implementations to use a
ServletContainerInitializer to drive any ServletContextInitializers.

This makes the lifecycle more consistent across the supported containers
and allows ServletListenerRegistrationBeans to be able to register
ServletContextListeners on all supported embedded containers.

Fixes gh-2192
10 years ago
..
src Use ServletContainerInitializers to start servers 10 years ago
.gitignore Restore test classes 11 years ago
pom.xml Auto-configure for Thymeleaf conditionalcomments 10 years ago