<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.0.xsd"
default-autowire="byName">
<beans>
1.上面使用default-autowire="byName"
查看default-autowire模板源码?

枚举:

<xsd:enumeration value="no"/>
<xsd:enumeration value="byName"/>
<xsd:enumeration value="byType"/>
<xsd:enumeration value="constructor"/>

四种类型:
1.<xsd:enumeration value="no"/>-不自动注入
2.<xsd:enumeration value="byName"/> 通过名称注入,类全名,首字母小写
3.
<xsd:enumeration value="byType"/> 通过类型注入,即引用时的名称。
4.
<xsd:enumeration value="constructor"/> 通过使用 配置的参数进行注入,如果参数不同,装配失败.




posted on 2018-09-27 16:05  塞北夜莺  阅读(197)  评论(0编辑  收藏  举报