SpringBoot入门(13)- SpringBoot 中使用Servlet API
1、静态文件默认路径及配置
autoconfig下的web下的ResourceProperties中
private static final String[] CLASSPATH_RESOURCE_LOCATIONS = {
"classpath:/META-INF/resources/", "classpath:/resources/",
"classpath:/static/", "classpath:/public/" };
2、在springboot环境中使用servlet API
a)HttpServlet
使用注解@WebServlet("path")配置访问路
在主函数类使用注解@ServletComponentScan扫描Servlet
serlvet实现方式二:
b)Filter 接口实现
使用注解@WebFilter(path)配置拦截路径
在主函数类使用注解@ServletComponentScan扫描Servlet
filter实现方式二:
c)listener
使用注解@WebListener配置
在主函数类使用注解@ServletComponentScan扫描Servlet
实现方式二