ServletContainerInitializer (Servlet 6.0 API Documentation - Apache Tomcat 10.1.55)
Description: declaration: package: jakarta.servlet, interface: ServletContainerInitializer

# Interface ServletContainerInitializer

public interface ServletContainerInitializer
ServletContainerInitializers (SCIs) are registered via an entry in the file META-INF/services/jakarta.servlet.ServletContainerInitializer that must be included in the JAR file that contains the SCI implementation.

SCI processing is performed regardless of the setting of metadata-complete. SCI processing can be controlled per JAR file via fragment ordering. If absolute ordering is defined, then only the JARs included in the ordering will be processed for SCIs. To disable SCI processing completely, an empty absolute ordering may be defined.

SCIs register an interest in annotations (class, method or field) and/or types via the `HandlesTypes` annotation which is added to the class.

Since:
  Servlet 3.0

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `onStartup(Set<Class<?>> c, ServletContext ctx)`
  Receives notification during startup of a web application of the classes within the web application that matched the criteria defined via the `HandlesTypes` annotation.

- ## Method Details

  - ### onStartup

    void onStartup(Set<Class<?>> c, ServletContext ctx) throws ServletException
    Receives notification during startup of a web application of the classes within the web application that matched the criteria defined via the `HandlesTypes` annotation.
    Parameters:
      `c` - The (possibly null) set of classes that met the specified criteria
      `ctx` - The ServletContext of the web application in which the classes were discovered
    Throws:
      `ServletException` - If an error occurs