How to use RequestBodyAdvice
14:10 08 Feb 2016
@ControllerAdvice
public class RequestBodyAdviceChain implements RequestBodyAdvice {

    @Override
    public boolean supports(MethodParameter methodParameter, Type type,
            Class< ? extends HttpMessageConverter< ? >> aClass) {
        return true;
    }

    @Override
    public Object handleEmptyBody(Object o, HttpInputMessage httpInputMessage, MethodParameter methodParameter,
            Type type, Class< ? extends HttpMessageConverter< ? >> aClass) {
        return o;
    }

    @Override
    public HttpInputMessage beforeBodyRead(HttpInputMessage httpInputMessage, MethodParameter methodParameter,
            Type type, Class< ? extends HttpMessageConverter< ? >> aClass) throws IOException {
        return httpInputMessage;
    }

    @Override
    public Object afterBodyRead(Object o, HttpInputMessage httpInputMessage, MethodParameter methodParameter, Type type,
            Class< ? extends HttpMessageConverter< ? >> aClass) {
        return o;
    }
}

Ideally, flow should reach these function first and then go to controller but it's not working.

java spring-mvc spring-boot