@@ -0,0 +1,2415 @@
+%0Aimport java.io.IOException;%0Aimport java.io.PrintWriter;%0A%0Aimport javax.servlet.http.HttpServletRequest;%0Aimport javax.servlet.http.HttpServletResponse;%0A%0Aimport org.springframework.core.MethodParameter;%0Aimport org.springframework.http.MediaType;%0Aimport org.springframework.http.converter.HttpMessageConverter;%0Aimport org.springframework.http.server.ServerHttpRequest;%0Aimport org.springframework.http.server.ServerHttpResponse;%0Aimport org.springframework.http.server.ServletServerHttpRequest;%0Aimport org.springframework.http.server.ServletServerHttpResponse;%0Aimport org.springframework.web.bind.annotation.ControllerAdvice;%0Aimport org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice;%0A%0Aimport com.fasterxml.jackson.databind.ObjectMapper;%0A%0Aimport lombok.extern.slf4j.Slf4j;%0A%0A@ControllerAdvice%0A@Slf4j%0Apublic class HeaderModifierAdvice implements ResponseBodyAdvice%3CObject%3E%0A%7B%0A    @Override%0A    public boolean supports(MethodParameter returnType, Class%3C? extends HttpMessageConverter%3C?%3E%3E converterType)%0A    %7B%0A        return true;%0A    %7D%0A%0A    @Override%0A    public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType,%0A        Class%3C? extends HttpMessageConverter%3C?%3E%3E selectedConverterType, ServerHttpRequest request,%0A        ServerHttpResponse response)%0A    %7B%0A        HttpServletRequest httpServletRequest = ((ServletServerHttpRequest)request).getServletRequest();%0A        HttpServletResponse httpServletResponse = ((ServletServerHttpResponse)response).getServletResponse();%0A%0A        boolean toJson = selectedContentType.equals(MediaType.APPLICATION_JSON);%0A%0A        if (toJson)%0A        %7B%0A            //httpServletResponse.setStatus(200);%0A            httpServletResponse.setContentType(%22application/json;charset=utf-8%22);%0A            httpServletResponse.setCharacterEncoding(%22UTF-8%22);%0A            try (PrintWriter writer = httpServletResponse.getWriter())%0A            %7B%0A                String content = new ObjectMapper().writeValueAsString(body);%0A                log.debug(%22start to handle toJson,source body is %7B%7D%22, content);%0A                writer.write(content);%0A                writer.flush();%0A%0A                //%E5%B7%B2%E7%BB%8F%E4%BD%BF%E7%94%A8%E8%BF%87writer%E6%AD%A4%E5%A4%84%E8%A6%81%E8%BF%94%E5%9B%9Enull%EF%BC%8C%E5%90%A6%E5%88%99%E4%BC%9A%E6%8A%A5writer%E5%A4%9A%E6%AC%A1%E4%BD%BF%E7%94%A8%E7%9A%84%E9%94%99%0A                return null;%0A            %7D%0A            catch (IOException e)%0A            %7B%0A                log.error(%22write toJson response failed!%22, e);%0A            %7D%0A        %7D%0A%0A        return body;%0A    %7D%0A%0A%7D%0A

Create HeaderModifierAdvice.java