===================== 自定义类型转换器_解决 ===================== 1 实现Converter接口 /src/main/java/cn/tedu/injection/StringToDate.java: public class StringToDate implements Converter { @Override public Date convert(String s) { Date date = null; ^ ----来自配置文件的属性值 try { date = new SimpleDateFormat("yyyy-MM-dd").parse(s); } catch (ParseException e) { e.printStackTrace(); } return date; } | } --->注入到对象属性中 2 在Spring配置文件中配置类型转换器对象 /src/main/resources/applicationContext.xml: 顺序与位置无所谓。 3 在Spring配置文件中注册类型转换器对象 /src/main/resources/applicationContext.xml: Person{name='1001', birthday=Mon Sep 10 00:00:00 CST 2018} 例程:Injection