Spring xml注入
构造方法注入:
<bean id="a" value="abcde"/><constructor-arg index="1" value="12345"/></bean>
??
?
?Setter方法注入:
<bean id="a" value="abcde"/><constructor-arg index="1" value="12345"/><property name="b" ref="b"/></bean>
?
?
DefaultListableBeanFactory factory = new DefaultListableBeanFactory();XmlBeanDefinitionReader reader = new XmlBeanDefinitionReader(factory);reader.loadBeanDefinitions("classpath:com/astute/sparrow/spring/ioc/test/spring-ioc-test.xml");A a = (A) factory.getBean("a");
??
?
?
?
?