摘要:
一、实验使用实体类 这2个类,并没有实际的父子关系,只是属性值一样 1.xml中,将Father类作为Son类的Parent 此时son这个bean的name是:llf,age是:22 。属性值完全继承于father这个bean,但是2个bean没有实际的继承关系,father只是作为一个模板的作用 阅读全文
posted @ 2020-04-17 22:06
linglongfang
阅读(458)
评论(0)
推荐(0)
摘要:
前面我们都是当bean中要引用另一个bean的时候,我们都是采用了ref去指定确切的bean的id 那么,Spring为我们提供了自动装配的功能,只需要在bean上添加一个属性即可 autowire属性,这个属性有2个值:byName和byType 当值为byName的时候,bean中属性(引用类型 阅读全文
posted @ 2020-04-17 18:23
linglongfang
阅读(172)
评论(0)
推荐(0)
摘要:
一、实验使用实体类 使用p空间去简化 <bean id="car" class="com.llf.bean.Car" p:brand="宝马" p:price="100000.0" p:speed="200" ></bean> 同样也可以使用ref <bean id="car" class="com 阅读全文
posted @ 2020-04-17 17:15
linglongfang
阅读(148)
评论(0)
推荐(0)
摘要:
一、实验使用实体类 RichMan类中有一个属性的类型是List<Car>类型 GreatMan类中有一个属性的类型是Map<String,Car>类型 这里不再使用Car类的有参构造方法,因为Car类这里只是为了new对象被RichMan和GreatMan所注入 1.将List注入,如果是引用类型 阅读全文
posted @ 2020-04-17 16:54
linglongfang
阅读(358)
评论(0)
推荐(0)
摘要:
一、实验使用实体类 Person类中有一个属性的类型是Car类型 这里不再提供Car类的有参构造方法,因为Car类这里只是为了new对象被Person所注入 Person提供有参构造方法 //无参构造 public Person() { } //有参构造 public Person(String n 阅读全文
posted @ 2020-04-17 16:08
linglongfang
阅读(299)
评论(0)
推荐(0)
摘要:
1.SpringXML配置Bean-属性注入(基本类型和String类型) 2.SpringXML配置Bean-属性注入(引用数据类型) 3.SpringXML配置Bean-属性注入(集合类型) 4.SpringXML配置Bean-p空间的使用 5.SpringIOC容器-xml配置bean-xml 阅读全文
posted @ 2020-04-17 12:24
linglongfang
阅读(91)
评论(0)
推荐(0)
摘要:
一、实验使用实体类 Car有2个构造器 //无参构造 public Car() {} //有参构造 public Car(String brand, double speed, double price) { this.brand = brand; this.speed = speed; this. 阅读全文
posted @ 2020-04-17 11:31
linglongfang
阅读(283)
评论(0)
推荐(0)

浙公网安备 33010602011771号