SpringApplyChapter4_4.zip
大小:11.17KB
价格:50积分
下载量:0
评分:
5.0
上传者:evankaka
更新日期:2025-09-22

IOC之基于注解的配置bean(下)

资源文件列表(大概)

文件名
大小
SpringApplyChapter4_4/
-
SpringApplyChapter4_4/.classpath
470B
SpringApplyChapter4_4/.project
397B
SpringApplyChapter4_4/.settings/
-
SpringApplyChapter4_4/.settings/org.eclipse.jdt.core.prefs
598B
SpringApplyChapter4_4/bin/
-
SpringApplyChapter4_4/bin/beans.xml
810B
SpringApplyChapter4_4/bin/com/
-
SpringApplyChapter4_4/bin/com/mucfc/
-
SpringApplyChapter4_4/bin/com/mucfc/dao/
-
SpringApplyChapter4_4/bin/com/mucfc/dao/UserDao.class
789B
SpringApplyChapter4_4/bin/com/mucfc/model/
-
SpringApplyChapter4_4/bin/com/mucfc/model/User.class
989B
SpringApplyChapter4_4/bin/com/mucfc/service/
-
SpringApplyChapter4_4/bin/com/mucfc/service/MyComponent.class
1.36KB
SpringApplyChapter4_4/bin/com/mucfc/service/MySerivce.class
606B
SpringApplyChapter4_4/bin/com/mucfc/test/
-
SpringApplyChapter4_4/bin/com/mucfc/test/Test.class
1.43KB
SpringApplyChapter4_4/src/
-
SpringApplyChapter4_4/src/beans.xml
810B
SpringApplyChapter4_4/src/com/
-
SpringApplyChapter4_4/src/com/mucfc/
-
SpringApplyChapter4_4/src/com/mucfc/dao/
-
SpringApplyChapter4_4/src/com/mucfc/dao/UserDao.java
422B
SpringApplyChapter4_4/src/com/mucfc/model/
-
SpringApplyChapter4_4/src/com/mucfc/model/User.java
355B
SpringApplyChapter4_4/src/com/mucfc/service/
-
SpringApplyChapter4_4/src/com/mucfc/service/MyComponent.java
889B
SpringApplyChapter4_4/src/com/mucfc/service/MySerivce.java
433B
SpringApplyChapter4_4/src/com/mucfc/test/
-
SpringApplyChapter4_4/src/com/mucfc/test/Test.java
892B

资源内容介绍

IOC之基于注解的配置bean(下),具体效果和过程看博文http://blog.csdn.net/evankaka/article/details/45077041
package com.mucfc.test;import org.springframework.context.ApplicationContext;import org.springframework.context.support.ClassPathXmlApplicationContext;import com.mucfc.service.MyComponent;import com.mucfc.service.MySerivce;public class Test {public static void main(String[] args) { ApplicationContext context = new ClassPathXmlApplicationContext("beans.xml"); MySerivce service= context.getBean("service", MySerivce.class); MyComponent myComponent=context.getBean("myComponent", MyComponent.class); System.out.println("--------list--------"); for (int i = 0; i < myComponent.getUserList().size(); i++) { System.out.println(myComponent.getUserList().get(i)); } System.out.println(service.getUserDao()); ; ((ClassPathXmlApplicationContext)context).destroy();}}

用户评论 (0)

发表评论

captcha