天空是藍色的

          做好軟件為中國 #gcc -c helloworld.c -o helloworld.o //編譯目標文件 #gcc helloworld.o -o helloworld //編譯成可執行exe #helloworld //運行exe
          數據加載中……
          理解IOC容器的概念和DI

          015.jpg

          Inversion of Control/Dependency Injection
          IOC容器
          相當于一個bean工廠,來管理整個應用程序中使用的bean,來管理這些bean的生命周期;

          實現IOC/DI是通過一堆描述文件,IOC容器根據這堆描述文件來實現創建對象提供服務等工作;

          一般情況下,我們通過new一個對象并調用這個對象的某個方法來完成服務.

          既然有了IOC容器管理概念,那么通過描述文件容器就為我們創建所需要對象和方法.

          好處就是減少了硬編碼.

          There are three different implementation pattern types for IoC:

          type-1 Services need to implement a dedicated interface through which they are provided with an object from which they can look up dependencies (other services). This is the pattern used by the earlier containers provided by Excalibur.
          type-2 Services dependencies upon are assigned via JavaBeans properties (setter methods). Both HiveMind and Spring use this approach.
          type-3 Services dependencies are provided as constructor parameters (and are not exposed as JavaBeans properties). This is the exclusive approach used by PicoContainer, and is also used in HiveMind and Spring.

          http://jakarta.apache.org/hivemind/ioc.html

          http://www.javaworld.com.tw/confluence/display/opensrc/Spring

          posted on 2005-12-23 10:04 bluesky 閱讀(744) 評論(0)  編輯  收藏 所屬分類: 工作總結

          主站蜘蛛池模板: 阿坝| 竹溪县| 仙游县| 新沂市| 徐汇区| 苍南县| 长武县| 黑河市| 茶陵县| 平凉市| 诸城市| 托克托县| 丰原市| 建始县| 龙胜| 北宁市| 宜兴市| 宁阳县| 长葛市| 璧山县| 新野县| 广汉市| 安陆市| 宣恩县| 调兵山市| 洛宁县| 古交市| 图们市| 平邑县| 盐山县| 沙雅县| 四川省| 富民县| 杭州市| 石泉县| 万盛区| 哈巴河县| 浏阳市| 广南县| 东辽县| 宜春市|