2012年11月28日

Spring2.5.6学习笔记-DI的两种注入方式

摘要: 1. 构造器注入通过带有参数的构造器来实现,每个参数代表着一个依赖1.1 构造器参数解析1.1.1 bean类型明确package x.y;public class Foo {public Foo(Bar bar, Baz baz) {// ...}}<beans><bean name="foo" class="x.y.Foo"><constructor-arg><bean class="x.y.Bar"/></constructor-arg><constructor- 阅读全文

posted @ 2012-11-28 13:35 炎川 阅读(569) 评论(0) 推荐(0) 编辑

Spring2.5.6学习笔记-实例化bean的几种方法

摘要: 1. 用构造器来实例化<bean id="exampleBean" class="examples.ExampleBean"/><bean name="anotherExample" class="examples.ExampleBeanTwo"/>2. 使用静态工厂方法实例化注:createInstance必须是一个static方法<bean id="exampleBean" class="examples.ExampleBean2" fact 阅读全文

posted @ 2012-11-28 10:30 炎川 阅读(212) 评论(0) 推荐(0) 编辑

导航