Dependence Injection 依赖注入,是在Spring IOC(控制反转)中为所创建对象属性赋值的方式,以下介绍常用的注入方式。
首先将Spring引入配置信息展示以下:
Spring配置信息,一般取名为 applicationContext.xml.
可以下载Spring IDE 插件,用起来更得心应手,文末附上下载链接。
首先我们先创建一个学生类,并写相应属性:
直接看代码,更加容易理解,注意对应着属性类型去看。
其实,常用的也就这几种,多加使用即可,俗话说的好,孰能生巧。
这里给下Spring IDE下载链接哈,使用后,6的飞起!!!!!
下载前,注意查看自己ecplice版本。
eclipse4.7.3a版本:
http://download.springsource.com/release/TOOLS/update/3.9.4.RELEASE/e4.7/springsource-tool-suite-3.9.4.RELEASE-e4.7.3a-updatesite.zip
eclipse4.7.3版本:
http://download.springsource.com/release/TOOLS/update/3.9.3.RELEASE/e4.7/springsource-tool-suite-3.9.3.RELEASE-e4.7.3-updatesite.zip
eclipse4.7.2版本:
http://download.springsource.com/release/TOOLS/update/3.9.2.RELEASE/e4.7/springsource-tool-suite-3.9.2.RELEASE-e4.7.2-updatesite.zip
eclipse4.7.1a版本:
http://download.springsource.com/release/TOOLS/update/3.9.1.RELEASE/e4.7/springsource-tool-suite-3.9.1.RELEASE-e4.7.1a-updatesite.zip
eclipse4.7.0版本:
http://download.springsource.com/release/TOOLS/update/3.9.0.RELEASE/e4.7/springsource-tool-suite-3.9.0.RELEASE-e4.7.0-updatesite.zip
eclipse4.6.3版本:
http://download.springsource.com/release/TOOLS/update/3.8.4.RELEASE/e4.6/springsource-tool-suite-3.8.4.RELEASE-e4.6.3-updatesite.zip
eclipse4.6.2版本:
http://download.springsource.com/release/TOOLS/update/3.8.3.RELEASE/e4.6/springsource-tool-suite-3.8.3.RELEASE-e4.6.2-updatesite.zip
eclipse4.6.1版本:
http://download.springsource.com/release/TOOLS/update/3.8.2.RELEASE/e4.6/springsource-tool-suite-3.8.2.RELEASE-e4.6.1-updatesite.zip
eclipse4.6版本:
http://download.springsource.com/release/TOOLS/update/3.8.1.RELEASE/e4.6/springsource-tool-suite-3.8.1.RELEASE-e4.6-updatesite.zip
http://download.springsource.com/release/TOOLS/update/3.8.0.RELEASE/e4.6/springsource-tool-suite-3.8.0.RELEASE-e4.6-updatesite.zip
eclipse4.5.2版本:
http://download.springsource.com/release/TOOLS/update/3.7.3.RELEASE/e4.5/springsource-tool-suite-3.7.3.RELEASE-e4.5.2-updatesite.zip
eclipse4.5.1版本:
http://download.springsource.com/release/TOOLS/update/3.7.2.RELEASE/e4.5/springsource-tool-suite-3.7.2.RELEASE-e4.5.1-updatesite.zip
http://download.springsource.com/release/TOOLS/update/3.7.1.RELEASE/e4.5/springsource-tool-suite-3.7.1.RELEASE-e4.5.1-updatesite.zip
eclipse4.5版本:
http://download.springsource.com/release/TOOLS/update/3.7.0.RELEASE/e4.5/springsource-tool-suite-3.7.0.RELEASE-e4.5-updatesite.zip
eclipse4.4.2版本:
http://download.springsource.com/release/TOOLS/update/3.6.4.RELEASE/e4.4/springsource-tool-suite-3.6.4.RELEASE-e4.4.2-updatesite.zip
eclipse4.4.1版本(SR1):
http://download.springsource.com/release/TOOLS/update/3.6.3.SR1/e4.4/springsource-tool-suite-3.6.3.SR1-e4.4.1-updatesite.zip
eclipse4.4.1版本:
http://download.springsource.com/release/TOOLS/update/3.6.3.RELEASE/e4.4/springsource-tool-suite-3.6.3.RELEASE-e4.4.1-updatesite.zip
http://download.springsource.com/release/TOOLS/update/3.6.2.RELEASE/e4.4/springsource-tool-suite-3.6.2.RELEASE-e4.4.1-updatesite.zip
eclipse4.4版本:
http://download.springsource.com/release/TOOLS/update/3.6.1.RELEASE/e4.4/springsource-tool-suite-3.6.1.RELEASE-e4.4-updatesite.zip
http://download.springsource.com/release/TOOLS/update/3.6.0.RELEASE/e4.4/springsource-tool-suite-3.6.0.RELEASE-e4.4-updatesite.zip
eclipse4.3.2版本:
http://download.springsource.com/release/TOOLS/update/3.5.1.RELEASE/e4.3/springsource-tool-suite-3.5.1.RELEASE-e4.3.2-updatesite.zip
http://download.springsource.com/release/TOOLS/update/3.5.0.RELEASE/e4.3/springsource-tool-suite-3.5.0.RELEASE-e4.3.2-updatesite.zip
eclipse4.3.1版本:
http://download.springsource.com/release/TOOLS/update/3.4.0.RELEASE/e4.3/springsource-tool-suite-3.4.0.RELEASE-e4.3.1-updatesite.zip
eclipse4.3版本:
http://download.springsource.com/release/TOOLS/update/3.3.0.RELEASE/e4.3/springsource-tool-suite-3.3.0.RELEASE-e4.3-updatesite.zip
eclipse4.2.2版本:
http://download.springsource.com/release/TOOLS/update/3.2.0.RELEASE/e4.2/springsource-tool-suite-3.2.0.RELEASE-e4.2.2-updatesite.zip
eclipse4.2版本:
http://download.springsource.com/release/TOOLS/update/3.1.0.RELEASE/e4.2/springsource-tool-suite-3.1.0.RELEASE-e4.2-updatesite.zip
---------------------
注:个人学习见解,不足之处还望少侠谅解,如有需要改正之处,请指教,谢谢。