File: Main.java 
 
import java.util.List; 
import java.util.Map; 
import java.util.Properties; 
import java.util.Set; 
 
import org.springframework.context.ApplicationContext; 
import org.springframework.context.support.ClassPathXmlApplicationContext; 
 
class Main { 
  public static void main(String args[]) throws Exception { 
    ApplicationContext ctx = new ClassPathXmlApplicationContext("context.xml"); 
     
     
    CollectionsBean example = (CollectionsBean) ctx.getBean("collectionsExample"); 
   System.out.println(example.getTheMap()); 
   
  } 
} 
class CollectionsBean { 
   
  private List theList; 
  private Set theSet; 
  private Map theMap; 
  private Properties theProperties; 
   
  public void setTheList(List theList) { 
    this.theList = theList; 
  } 
  public List getTheList() { 
    return theList; 
  } 
   
  public void setTheSet(Set theSet) { 
    this.theSet = theSet; 
  } 
  public Set getTheSet() { 
    return theSet; 
  } 
   
  public void setTheMap(Map theMap) { 
    this.theMap = theMap; 
  } 
  public Map getTheMap() { 
    return theMap; 
  } 
   
  public void setTheProperties(Properties theProperties) { 
    this.theProperties = theProperties; 
  } 
  public Properties getTheProperties() { 
    return theProperties; 
  } 
} 
 
 
File: context.xml 
 
<?xml version="1.0" encoding="UTF-8"?> 
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" 
    "http://www.springframework.org/dtd/spring-beans.dtd"> 
 
<beans> 
 
  <bean id="collectionsExample" class="CollectionsBean"> 
     
 
    <property name="theMap"> 
      <map> 
        <entry key="left"> 
          <value>right</value> 
        </entry> 
        <entry key="up"> 
          <value>down</value> 
        </entry> 
        <entry key="date"> 
          <ref local="curDate"/> 
        </entry> 
      </map> 
    </property> 
 
  </bean> 
   
  <bean id="curDate" class="java.util.GregorianCalendar"/> 
   
</beans> 
 
 
 
 
            
       
  |