package org.springframework.web;
@javax.servlet.annotation.HandlesTypes({org.springframework.web.WebApplicationInitializer.class})
public class SpringServletContainerInitializer implements javax.servlet.ServletContainerInitializer {
public SpringServletContainerInitializer() { /* compiled code */ }
public void onStartup(@org.springframework.lang.Nullable java.util.Set<java.lang.Class<?>> webAppInitializerClasses,
javax.servlet.ServletContext servletContext)
throws javax.servlet.ServletException { /* compiled code */ }
}
这段代码是springboot的启动代码。
1.注解不仅可以用在方法上,也可以用在参数上。
2.在servlet3.0环境中,容器会查找实现了javax.servlet.ServletContainerInitializer接口的类,如代码中的SpringServletContainerInitializer,就会使用其配置servlet容器。而该类又会查找实现了WebApplicationInitializer的类,AbstractAnnotationConfigDispatcherServletInitializer就实现了该类。
3.问题,如何在springboot中自定义自己的拦截器?