IoC容器-Bean管理XML方式(注入集合类型属性)

Ico操作Bean管理(xml注入集合属性)

1,注入数组类型属性

2,注入List集合类型属性

3,注入Map集合类型属性

  (1)创建类,定义数组、list、map、set类型属性,生成对应set方法

      

 

 

  (2)在spring配置文件进行配置

    

4,在集合中设置对象类型值

    

 

 

     

 

 

 

5,把集合注入部分提取出来

   (1)在spring配置文件中引入名称空间 util

       

xmlns:util="http://www.springframework.org/schema/util"
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd

 

   (2)使用util标签完成list集合注入提取

    

 

 

3

 

posted @ 2021-11-24 22:43  doremi429  阅读(33)  评论(0编辑  收藏  举报