spring 的默认自动装配是什么?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/9519460/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the default autowiring in spring?
提问by M Sach
Looking at my web application, it looks like the default autowiring is by name. I did not use the autowire keyword in any XML files, but it's still autowiring. Based on this link, it looks like no autowiring should happen in this case.
查看我的 Web 应用程序,看起来默认的自动装配是按名称进行的。我没有在任何 XML 文件中使用 autowire 关键字,但它仍然是自动装配的。根据此链接,在这种情况下似乎不应发生自动装配。
Why is this happening? Can we set it at a global level somewhere in the project?
为什么会这样?我们可以在项目的某个地方将它设置为全局级别吗?
回答by Igorock
The default autowiring in spring is by type
spring 中的默认自动装配是按类型

