Web Technology Spring Dependent Injection:依赖注入 Type1:接口注入:实现容器接口,由容器完成对象关系的建立。侵入 式代码。 Type2: setter注入: setxXx(0, spring推荐。 Type3: constructor注入。在实例化时完成注入。运行时难以改变。 Demo Springloc DemolComputer in Dos env HelloSpring in Myeclipse envWeb Technology 16 Spring ▪ Dependent Injection: 依赖注入 - Type1: 接口注入:实现容器接口,由容器完成对象关系的建立。侵入 式代码。 - Type2: setter注入:setXXX(),spring推荐。 - Type3: constructor注入。在实例化时完成注入。运行时难以改变。 Demo SpringIOCDemo\Computer in DOS env HelloSpring in Myeclipse env