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
实现方式二
本文介绍SpringBoot中静态资源的默认路径配置方法,包括ResourceProperties的CLASSPATH_RESOURCE_LOCATIONS属性设置。同时,详细讲解了在SpringBoot环境下如何使用servlet API,包括HttpServlet、Filter接口和Listener的三种实现方式及其配置。
629

被折叠的 条评论
为什么被折叠?



