接口 ServletContextInitializer

所有已知实现类:
AbstractFilterRegistrationBean, DelegatingFilterProxyRegistrationBean, DispatcherServletRegistrationBean, DynamicRegistrationBean, FilterRegistrationBean, RegistrationBean, ServletEndpointRegistrar, ServletListenerRegistrationBean, ServletRegistrationBean
函数接口:
这是一个函数接口, 因此可用作 lambda 表达式或方法引用的赋值目标。

@FunctionalInterface public interface ServletContextInitializer
Interface used to configure a Servlet 3.0+ context programmatically. Unlike WebApplicationInitializer, classes that implement this interface (and do not implement WebApplicationInitializer) will not be detected by SpringServletContainerInitializer and hence will not be automatically bootstrapped by the Servlet container.

This interface is designed to act in a similar way to ServletContainerInitializer, but have a lifecycle that's managed by Spring and not the Servlet container.

For configuration examples see WebApplicationInitializer.

从以下版本开始:
1.4.0
作者:
Phillip Webb
另请参阅:
  • 方法概要

    修饰符和类型
    方法
    说明
    void
    onStartup(ServletContext servletContext)
    Configure the given ServletContext with any servlets, filters, listeners context-params and attributes necessary for initialization.
  • 方法详细资料

    • onStartup

      void onStartup(ServletContext servletContext) throws ServletException
      Configure the given ServletContext with any servlets, filters, listeners context-params and attributes necessary for initialization.
      参数:
      servletContext - the ServletContext to initialize
      抛出:
      ServletException - if any call against the given ServletContext throws a ServletException