Spring 注入 List Set Properties Map
要抓住主要矛盾,最主要的配置如下:
package com.myapp.core.collection;import org.springframework.context.ApplicationContext;import org.springframework.context.support.ClassPathXmlApplicationContext;public class TestMain { public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("SpringBeans.xml"); Customer customer = (Customer)context.getBean("customerBean"); System.out.println(customer.toString()); }}运行结果如下:
[3[ name: top address: beijing age:1][ name: myList address: myaddress age:24]]
[[3, [ name: top address: beijing age:1], [ name: myList address: myaddress age:24]]]
[example1:love1example2:[ name: top address: beijing age:1]example3:[ name: myList address: myaddress age:24]]
[{key2=myexample--value2, key1=myexample--value1}]