文章目录
0、前言
Spring框架中bean标签具有多个属性,其中属性autowire的主要目的是针对bean内对象做相应的“自动装配”,本文将细致介绍本属性及其应用
1、autowire属性介绍
1.1.autowire官方介绍
对于bean标签的相关使用,spring框架将之存放在spring-beans-XXX.jar中以下两个文件中:
- spring-beans.dtd相对路径org\springframework\beans\factory\xml\spring-beans.dtd)
- spring-beans.xsd(相对路径org\springframework\beans\factory\xml\ spring-beans.xsd)
其中,在 spring-beans.dtd 中对autowire属性有如下介绍
Optional attribute controlling whether to "autowire" bean properties.
This is an automagical process in which bean references don't need to be coded
explicitly in the XML bean definition file, but Spring works out dependencies.
There are 5 modes:
1. "no"
The traditional Spring default. No automagical wiring. Bean references
must be