Collection properties of spring beans

Spring provides special configuration element tags for the basic collection types set, list, map, and Properties. Among them, Properties can be regarded as a special case of Map. Both the key and value of Map can be objects, but the KEY and value of Properties can only be strings.

<!-- Collection properties -->
           < bean id = "world4" class = "com.modle.World" >
               <!----> < property name = "sprotsList" >
                    < list >
                    < value > 红警 </ value >
                    < value > 战地 </ value >
                    < value > fifa </ value >
                    </ list >
               </ property >
               < property name = "set" >
               < set >
                    < value > 123 </ value >
                    < value > 124 </ value >
                    < value > 125 </ value >
               </ set >
               </ property >
               < property name = "map" >
                    < map >
                         < entry >
                              < key >< value > ab </ value ></ key >
                              < value > ac </ value >
                         </ entry >
                         < entry >
                              < key >< value > abc </ value ></ key >
                              < value > acd </ value >
                         </ entry >
                    </ map >
               </ property >
               < property name = "properties" >
               < props >
                    < prop key = "key1" > com1 </ prop >
                    < prop key = "key2" > com2 </ prop >
               </ props >
                   
               </ property >
           </ bean >

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325472406&siteId=291194637
Recommended