例として、文字列を今までに取る:
コンバーターを定義します。
java.text.parseexception; Import java.util.date; Import org.apache.commons.lang.time.dateutils; Import org.springframework.core.convert.converter; public class string2dateconverter exmferment converter <string> {private string = " format){this.format = format;}@overridepublic date convert(string arg0){try {return dateutils.parsedate(arg0、new string [] {format});} catch(parseexception e){return null;}}}}}Springを構成します:
<bean id = "conversionservice"> <プロパティ名= "converters"> <list> <bean/> </list> </property> </bean>
上記は、編集者が紹介したスプリングタイプの変換変換Convertor Convertorです。私はそれが誰にでも役立つことを願っています。