类 ServletRegistrationBean<T extends Servlet>

类型参数:
T - the type of the Servlet to register
所有已实现的接口:
Aware, BeanNameAware, ServletContextInitializer, Ordered
直接已知子类:
DispatcherServletRegistrationBean

public class ServletRegistrationBean<T extends Servlet> extends DynamicRegistrationBean<ServletRegistration.Dynamic>
A ServletContextInitializer to register Servlets in a Servlet 3.0+ container. Similar to the registration features provided by ServletContext but with a Spring Bean friendly design.

The servlet must be specified before calling RegistrationBean.onStartup(jakarta.servlet.ServletContext). URL mapping can be configured used setUrlMappings(java.util.Collection<java.lang.String>) or omitted when mapping to '/*' (unless alwaysMapUrl is set to false). The servlet name will be deduced if not specified.

从以下版本开始:
1.4.0
作者:
Phillip Webb
另请参阅:
  • 构造器详细资料

    • ServletRegistrationBean

      public ServletRegistrationBean()
      Create a new ServletRegistrationBean instance.
    • ServletRegistrationBean

      public ServletRegistrationBean(T servlet, String... urlMappings)
      Create a new ServletRegistrationBean instance with the specified Servlet and URL mappings.
      参数:
      servlet - the servlet being mapped
      urlMappings - the URLs being mapped
    • ServletRegistrationBean

      public ServletRegistrationBean(T servlet, boolean alwaysMapUrl, String... urlMappings)
      Create a new ServletRegistrationBean instance with the specified Servlet and URL mappings.
      参数:
      servlet - the servlet being mapped
      alwaysMapUrl - if omitted URL mappings should be replaced with '/*'
      urlMappings - the URLs being mapped
  • 方法详细资料