TomcatAutoConfiguration { @Bean public WebServerFactoryCustomizer<TomcatServletWebServerFactory> jsfTomcatFactoryCustomizer() { return factory -> factory.addContextCustomizers(this.customizer); }  @Bean JsfTomcatApplicationListener jsfTomcatApplicationListener(); @Bean WebServerFactoryCustomizer<TomcatServletWebServerFactory> jsfTomcatFactoryCustomizer();  }
@Test public void customize() { TomcatServletWebServerFactory tomcatFactory = new TomcatServletWebServerFactory(); this.tomcatAutoConfiguration.jsfTomcatFactoryCustomizer().customize(tomcatFactory); assertThat(tomcatFactory.getTomcatContextCustomizers()) .isNotEmpty(); }
@Test public void doNotCustomize() { TomcatServletWebServerFactory tomcatFactory = new TomcatServletWebServerFactory(); this.tomcatAutoConfiguration.jsfTomcatFactoryCustomizer().customize(tomcatFactory); assertThat(tomcatFactory.getTomcatConnectorCustomizers()) .isEmpty(); }