天空是藍色的

          做好軟件為中國 #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)  編輯  收藏 所屬分類: 工作總結

          主站蜘蛛池模板: 长治市| 健康| 苍山县| 永顺县| 星子县| 石狮市| 额济纳旗| 双鸭山市| 孙吴县| 曲阜市| 渝中区| 贵南县| 伊金霍洛旗| 常熟市| 徐水县| 阿图什市| 东丽区| 鸡泽县| 灵山县| 建平县| 寿阳县| 大同市| 萨嘎县| 封丘县| 蒙城县| 精河县| 天长市| 青岛市| 岐山县| 新昌县| 黔西县| 五河县| 会宁县| 兖州市| 康乐县| 紫云| 门源| 饶阳县| 大兴区| 蚌埠市| 东山县|