You can consider the use of @ControllerAdvice
annotation. The classes with this annotation assist every controller.
So you can write something like this:
@ControllerAdvice
public class GlobalInitializer {
@InitBinder
public void globalBinder(WebDataBinder webDataBinder) {
SimpleDateFormat df = new SimpleDateFormat(dateFormat);
df.setLenient(false);
webDataBinder.registerCustomEditor(Date.class, new CustomDateEditor(df, true));
}
}