无法在Interceptor类上注册initBinder

时间:2017-05-23 12:13:23

标签: spring-mvc binding

我试图在initBinder课程上注册Interceptor,但我无法这样做。

这是我的代码:

@InitBinder
protected void initBinder(final WebDataBinder binder) {
    final String mysqlDatePattern = this.messageSource.getMessage("calendar.format", null, LocaleContextHolder.getLocale());
    final String javaDatePattern = StringReplaceUtils.mysqlToJavaDatePattern(mysqlDatePattern);     
    binder.registerCustomEditor(Date.class, new CustomDateEditor(new SimpleDateFormat(javaDatePattern, LocaleContextHolder.getLocale()), true));    
}
}

0 个答案:

没有答案