标签:nbsp for turn val err att orm time 参数
@Configuration public class DateTimeFormatConfiguration extends WebMvcConfigurerAdapter { @Value(value = "${spring.jackson.date-format:yyyy-MM-dd HH:mm:ss}") private String formatString; @Override public void addFormatters(FormatterRegistry registry) { registry.addConverter(new DateConvert()); } public class DateConvert implements Converter<String, Date>{ private SimpleDateFormat formatter= new SimpleDateFormat(formatString); @Override public Date convert(String s) { if(StringUtil.isNullOrEmpty(s)){ return null; } try { Date date = formatter.parse(s); return date; } catch (ParseException e) { e.printStackTrace(); } return null; } } }
标签:nbsp for turn val err att orm time 参数
原文地址:https://www.cnblogs.com/Leechg/p/10362337.html