第一章、简介
平时我们在C#或java中创建类的对象的时候,给类对象的属性赋值,就叫做属性注入。常用(或者说普通的)的属性注入方式有三种:
- set方法注入
- 有参数构造注入
- 接口注入
但是在Spring框架中,只支持前两种:
- XML中Beans的有参构造注入(最常用)——请看第五章。
- XML中Beans的set注入——请看第六章。
第二章、普通的set方法注入
![](http://www.shareblogs.top/wp-content/uploads/2020/02/%E5%B1%9E%E6%80%A7%E6%B3%A8%E5%85%A5%EF%BC%9Aset%E6%96%B9%E6%B3%95%E6%B3%A8%E5%85%A5.png)
第三章、 常用的有参数构造注入
![](http://www.shareblogs.top/wp-content/uploads/2020/02/%E5%B1%9E%E6%80%A7%E6%B3%A8%E5%85%A5%EF%BC%9A%E6%9C%89%E5%8F%82%E6%9E%84%E9%80%A0%E6%B3%A8%E5%85%A5.png)
第四章、普通的接口注入
![](http://www.shareblogs.top/wp-content/uploads/2020/02/%E5%B1%9E%E6%80%A7%E6%B3%A8%E5%85%A5%EF%BC%9A%E6%8E%A5%E5%8F%A3%E6%B3%A8%E5%85%A5.png)
第五章、XML中Beans的 有参构造 注入
![](http://www.shareblogs.top/wp-content/uploads/2020/02/XML%E4%B8%ADBeans%E7%9A%84set%E6%B3%A8%E5%85%A51.png)
![](http://www.shareblogs.top/wp-content/uploads/2020/02/XML%E4%B8%ADBeans%E7%9A%84set%E6%B3%A8%E5%85%A52.png)
![](http://www.shareblogs.top/wp-content/uploads/2020/02/XML%E4%B8%ADBeans%E7%9A%84set%E6%B3%A8%E5%85%A53.png)
第六章、XML中Beans的 set 注入
![](http://www.shareblogs.top/wp-content/uploads/2020/02/XML%E4%B8%ADBeans%E7%9A%84-set-%E6%B3%A8%E5%85%A51.png)
![](http://www.shareblogs.top/wp-content/uploads/2020/02/XML%E4%B8%ADBeans%E7%9A%84-set-%E6%B3%A8%E5%85%A52.png)
![](http://www.shareblogs.top/wp-content/uploads/2020/02/XML%E4%B8%ADBeans%E7%9A%84-set-%E6%B3%A8%E5%85%A53.png)