新增AI编程课程,引领技术教育新趋势
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd"> <bean class="com.leanspringioc.AdminUser" id="adminUser"/> <bean class="com.leanspringioc.VipUser" id="vipUser"/> <bean class="com.leanspringioc.TestIOC" id="testIOC"> <property name="iUser" ref="vipUser"/> </bean></beans>
/** * 在applicationContext.xml文件中向testIOCBean中注入vipUser和adminUser进行测试 * * @param args */ public static void main(String[] args) { ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml"); TestIOC testIOC = (TestIOC) context.getBean("testIOC"); testIOC.say(); }
自动扫描装配Bean的相关注解
自动装配Bean相关注解