Problem resolved by aspect
Code:
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
@Component
@Aspect
public class RepairParametersAspect {
@Around("execution(@org.springframework.web.bind.annotation.RequestMapping * *(..))")
public Object callMethod(ProceedingJoinPoint pjp) throws Throwable{
Object[] args = pjp.getArgs();
for(int i=0;i<args.length;i++){
if(args[i] instanceof Integer[] && ((Integer[])args[i]).length==0 ){
args[i] = new Integer[]{null};
} else if(args[i] instanceof Double[] && ((Double[])args[i]).length==0 ){
args[i] = new Double[]{null};
} else if(args[i] instanceof String[] && ((String[])args[i]).length==0 ){
args[i] = new String[]{null};
}
}
return pjp.proceed(args);
}
}