• Andy Wilkinson's avatar
    Register @WebListeners in a way that allows them to register components · fafc0a91
    Andy Wilkinson authored
    Previously, @WebListeners were discovered via custom component scanning
    and then registered programmatically via the ServletContext. The servlet
    spec requires any ServletContextListener registered in this manner to be
    prohibited from programatically configuring servlets, filters, and
    listeners. This left us not strictly complying with the servlet spec
    as a ServletContextListener registered via a @WebListener annotation
    should be able to programatically configure other components.
    
    This commit updates WebListenerHandler to register each @WebListener
    component directly with Jetty, Tomcat, or Undertow rather than via the
    ServletContext API. This ensure that any @WebListener-annoated
    ServletContextListener registered via servlet component scanning is
    able to programatically register servlets, filters, and listeners.
    
    There is a small chance that this will be a breaking change for some
    users:
    
    1. The ServletListenerRegistrationBeans that were previously defined
       for each @WebListener will now be
       WebListenerHandler.WebListenerRegistrars
    2. Each @WebListener-annotated class will now be instantiated by
       Jetty, Tomcat, or Undertow. Jetty and Tomcat both require the class
       to be public and have a public default constructor. Previously,
       a package-private class or default constructor could be used as the
       instantiation was performed by Spring Framework. Undertow is not
       affected as it can instantiate a package-private type.
    
    Fixes gh-18303
    fafc0a91
Name
Last commit
Last update
.github Loading commit data...
buildSrc Loading commit data...
ci Loading commit data...
eclipse Loading commit data...
git/hooks Loading commit data...
gradle/wrapper Loading commit data...
idea Loading commit data...
spring-boot-project Loading commit data...
spring-boot-tests Loading commit data...
src Loading commit data...
.editorconfig Loading commit data...
.gitignore Loading commit data...
CODE_OF_CONDUCT.adoc Loading commit data...
CONTRIBUTING.adoc Loading commit data...
LICENSE.txt Loading commit data...
README.adoc Loading commit data...
SUPPORT.adoc Loading commit data...
build.gradle Loading commit data...
gradle.properties Loading commit data...
gradlew Loading commit data...
gradlew.bat Loading commit data...
settings.gradle Loading commit data...