resource/src/webapp下的文件可以直接访问,以下为四个静态资源的路径,可以通过配置项修改
"classpath:/META-INF/resources/", "classpath:/resources/",
"classpath:/static/", "classpath:/public/"
spring boot 中Servlet的api
springboot 中拦截器
1、写一个拦截器实现HandlerInterceptor接口
2、写一个类继承WebMvcConfigurerAdapter接口,重写addIntercepters方法,并调用registry.addInterceptor 加入刚才的拦截器
preHandle controller执行之前调用
postHandle controller执行之后,页面渲染之前调用
afterCompletion 页面渲染之后调用,一般用于资源清理操作
springboot中的异常处理
禁用系统默认的异常处理(exclude=ErrorMcvAutoCon(exclude=ErrorMcvAutoConfiguration.class))