public Object beforeBodyWrite(
            Object body,
            MethodParameter returnType,
            MediaType selectedContentType,
            Class<? extends HttpMessageConverter<?>> selectedConverterType,
            ServerHttpRequest request,
            ServerHttpResponse response
    ) {
        ResponseJSONP responseJsonp = returnType.getMethodAnnotation(ResponseJSONP.class);
        if (responseJsonp == null) {
            responseJsonp = returnType.getContainingClass().getAnnotation(ResponseJSONP.class);
        }

        HttpServletRequest servletRequest = ((ServletServerHttpRequest) request).getServletRequest();
        String callbackMethodName = servletRequest.getParameter(responseJsonp.callback());

        if (!IOUtils.isValidJsonpQueryParam(callbackMethodName)) {
            if (logger.isDebugEnabled()) {
                logger.debug("Invalid jsonp parameter value:" + callbackMethodName);
            }
            callbackMethodName = null;
        }

        JSONPObject jsonpObject = new JSONPObject(callbackMethodName);
        jsonpObject.addParameter(body);
        beforeBodyWriteInternal(jsonpObject, selectedContentType, returnType, request, response);
        return jsonpObject;
    }
Created by SongLing.Dong on 7/22/2017.
<p>
Wrap with the return object from method annotated by <code>@ResponseJSONP</code>
in order to be serialized into jsonp format.
</p>
<p>
url: /path/to/your/api?<b>callback=functionName</b>
</p>

@see JSONPObject
@see ResponseJSONP
@since Spring 4.2 when ResponseBodyAdvice is supported.
<p>
In Spring 3.x, use method directly return a <code>JSONPObject</code> instead.
</p>
fastjson1-compatible/src/main/java/com/alibaba/fastjson/support/spring/JSONPResponseBodyAdvice.java