1、spi
ServiceLoader<SpiService> load = ServiceLoader.load(ServletContainerInitializer.class);
2、
/*Class<T> serviceType; String configFile = SERVICES + serviceType.getName();*/ String configFile = "META-INF/services/javax.servlet.ServletContainerInitializer"; Enumeration<URL> resources = ClassLoader.getSystemResources(configFile); while (resources.hasMoreElements()) { parseConfigFile(containerServicesFound, resources.nextElement()); }