import org.springframework.beans.propertyeditors.StringTrimmerEditor;
import org.springframework.web.bind.WebDataBinder;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.InitBinder;
@ControllerAdvice
public class GlobalControllerAdvice {
@InitBinder (1)
public void initBinder(WebDataBinder binder) {
StringTrimmerEditor stringtrimmer = new StringTrimmerEditor(false); (2)
binder.registerCustomEditor(String.class, stringtrimmer); (3)
}
}