Spring中的自动装配案例分析

来源:互联网 发布:ubuntu安装tomcat8 编辑:程序博客网 时间:2024/05/16 00:53

参考地址:http://www.verydemo.com/demo_c143_i23211.html

Spring_Autowiring collaborators

Mode

Explanation

no

(Default) No autowiring. Bean references must be defined via a ref element. Changing the default setting is not recommended for larger deployments, because specifying collaborators explicitly gives greater control and clarity. To some extent, it documents the structure of a system.

byName

Autowiring by property name. Spring looks for a bean with the same name as the property that needs to be autowired. For example, if a bean definition is set to autowire by name, and it contains a master property (that is, it has a setMaster(..) method), Spring looks for a bean definition named master, and uses it to&nb…………………………………………………………………………

0 0