您的位置:首页 > 编程语言 > Java开发

一则spring中使用PropertyEditors 来注入日期型属性的技巧

2005-03-09 20:25 429 查看
如题。   
<bean id="customEditorConfigurer" class="org.springframework.beans.factory.config.CustomEditorConfigurer">
      <property name="customEditors">
      <map>
        <entry key="java.util.Date">
        <bean class="org.springframework.beans.propertyeditors.CustomDateEditor">
          <constructor-arg index="0">
             <bean class="java.text.SimpleDateFormat">
                <constructor-arg><value>yyyy-MM-dd</value></constructor-arg>
             </bean>
         </constructor-arg>
         <constructor-arg index="1"><value>false</value></constructor-arg>
       </bean>
       </entry>
     </map>
     </property>
    </bean>
      
  <bean id="datetestBean" class="com.huatek.model.DateTestBean">    
      <property name="date"> <value>1981-01-01</value> </property>
  </bean>   
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  spring bean class date
相关文章推荐