【Spring】依赖注入(array , list ,map)

public class Student{
    private String[]  books;
    private List hobbies;
    private Map card;

    public String[] getBooks() {
        return books;
    }

    public void setBooks(String[] books) {
        this.books = books;
    }

    public List getHobbies() {
        return hobbies;
    }

    public void setHobbies(List hobbies) {
        this.hobbies = hobbies;
    }

    public Map getCard() {
        return card;
    }

    public void setCard(Map card) {
        this.card = card;
    }

    @Override
    public String toString() {
        return "Student{" +
                "books=" + Arrays.toString(books) +
                ", hobbies=" + hobbies +
                ", card=" + card +
                '}';
    }
}


    
        
        
            
                三国演义
                红楼梦
                水浒传
                西游记
            
        

        
        
            
                篮球
                画画
                音乐
            
        

        
        
            
                
                
            
        

    



 


public class Test4 {
    public static void main(String[] args) {
        ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml");
        Student student=(Student) context.getBean("student");
        System.out.println(student.toString());
    }
}

【Spring】依赖注入(array , list ,map)_第1张图片 

 

你可能感兴趣的:(Spring,spring,list,windows)