]]>
        
        
    

    
        
        
        
        

         
         
            
                
                
                
            
         
    

    
        
        
        

        
        
        
    

    
    
    
        
        
        
    

    
    
        
        
        
        
            
                
                
            
        
    

    
    
        
            
            
                root
                1234
                jdbc:mysql:///test
                com.mysql.jdbc.Driver
            
             
    

    
    
        
        
    

    
        
        
        
    
package com.atguigu.spring.beans.collection;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Main {

    public static void main(String[] args) {
        //创建 spring 的 IOC容器对象
        ApplicationContext ctx = new ClassPathXmlApplicationContext("one.xml");

        //从 IOC 容器对象中获取 Bean 的实例
//      Person person = (Person) ctx.getBean("person3");
//      Person person2 = (Person) ctx.getBean("mapPerson");
//      DataSource dataSource = ctx.getBean(DataSource.class);
        Person person4 = (Person) ctx.getBean("person4");

        //打印
        //System.out.println(person);
//      System.out.println(person2);
//      System.out.println(dataSource);
        System.out.println(person4);
    }

}
package com.atguigu.spring.beans.collection;

import java.util.List;
import java.util.Map;

import com.atguigu.spring.beans.Car;

public class Person {
    private String name;
    private int age;
    //private List cars;
    private Map cars1;

    public Map getCars1() {
        return cars1;
    }
    public void setCars1(Map cars1) {
        this.cars1 = cars1;
    }

    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public int getAge() {
        return age;
    }
    public void setAge(int age) {
        this.age = age;
    }
//  public List getCars() {
//      return cars;
//  }
//  public void setCars(List cars) {
//      this.cars = cars;
//  }

//  @Override
//  public String toString() {
//      return "Person [name=" + name + ", age=" + age + ", cars=" + cars1 + "]";
//  }

//  public Person(String name, int age, List cars) {
//      super();
//      this.name = name;
//      this.age = age;
//      this.cars = cars;
//  }
    public Person() {
        super();
    }

    public Person(String name, int age, Map cars1) {
        super();
        this.name = name;
        this.age = age;
        this.cars1 = cars1;
    }
    @Override
    public String toString() {
        return "Person [name=" + name + ", age=" + age + ", cars1=" + cars1 + "]";
    }

}