0219 springmvc-拦截器和响应增强
拦截器 拦截器分同步拦截器和异步拦截器; HandlerInterceptor 方法和执行时机 可以看DispathcerServlet的原来确定它的三个方法的执行时机; AsynHandlerInterceptor 看注释,主要用来清理在并发环境加清理ThreadLocal的数据; ResponseBodyAdvice 对返回值备注了@ResponseBody或者返回ResponseEntity做了一些加工; 会在使用消息转换器转换为json数据之前进行数据转换输出; package com.springbootpractice.interceptor.config; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.databind.ObjectMapper; import com.springbootpractice.interceptor.config.interceptor.MyInterceptor; import lombok.SneakyThrows; import org.springframework.context.annotation.Configuration; import org.springframework.core