Properties Setting: Date : XML Bean Property « Spring « Java

Properties Setting: Date

File: context.xml

<?xml version="1.0" encoding="UTF-8"?>

  <bean id="customEditorConfigurer"
    <property name="customEditors">

        <entry key="java.util.Date">
          <bean class="org.springframework.beans.propertyeditors.CustomDateEditor">
            <constructor-arg index="0">
              <bean class="java.text.SimpleDateFormat">
            <constructor-arg index="1"><value>true</value></constructor-arg>

  <bean id="startEndDatesBean" class="StartEndDatesBean">
    <property name="startDate"><value>10/09/2001</value></property>
    <property name="endDate"><value>10/26/2008</value></property>



import java.util.Date;

import org.springframework.context.ApplicationContext;

class Main {
  public static void main(String args[]) throws Exception {

    ApplicationContext ctx = new ClassPathXmlApplicationContext(
    StartEndDatesBean startEnd = (StartEndDatesBean) ctx.getBean("startEndDatesBean");
class StartEndDatesBean {
  Date startDate;
  Date endDate;
  public void setStartDate(Date startDate) {
    this.startDate = startDate;
  public Date getStartDate() {
    return startDate;
  public void setEndDate(Date endDate) {
    this.endDate = endDate;
  public Date getEndDate() {
    return endDate;


       2,893 k)

Related examples in the same category

1.Property Setting: URL
2.PropertySetting: String Array
3.Property Setting: Stream From URL
4.Property Setting: Properties
5.Property Setting: Integer
6.Property Setting: File
7.Property Setting: Class type
8.Property Setting: Byte Array
9.Property Setting: Boolean
10.Property Setting: BigDecimal
11.Load property File In Context
12.lazy init
13.Fill Value To List
14.Fill Map
15.Fill Set
16.Fill Properties
17.Fill List To Another List
18.Fill Calendar Object To List
19.Create List Map In Context
20.Bean Injection: Map
21.Bean Injection Collection: Set
22.Bean Injection: Collection Properties
23.Bean Injection Collection: Map
24.Bean Injection Collection: List