spring复杂类型依赖注入

    科技2025-09-10  46

    思维导图:

    接着上一篇的代码

    applicationContext.xml

    <bean id="person1" class="com.lbl.domain.Person"> <property name="id" value="10"></property> <property name="name" value="jack"></property> <property name="list"> <list> <value>rose</value> <value>rose</value> <value>tom</value> </list> </property> </bean>

    personTest

    @Test public void test02(){ ClassPathXmlApplicationContext onctext=new ClassPathXmlApplicationContext("applicationContext.xml"); Object person = onctext.getBean("person1"); System.out.println(person); }

    Processed: 0.012, SQL: 8