博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Spring对于注解的扫描
阅读量:7077 次
发布时间:2019-06-28

本文共 857 字,大约阅读时间需要 2 分钟。

hot3.png

对于这两个配置Spring中已经做出了很明确的说明

<context:annotation-config/>

(The implicitly registered post-processors include ,, as well as the aforementioned .)

<context:annotation-config/> only looks for annotations on beans in the same application context in which it is defined. This means that, if you put<context:annotation-config/> in a WebApplicationContext for a DispatcherServlet, it only checks for @Autowired beans in your controllers, and not your services. See Section 17.2, “The DispatcherServlet” for more information.

The use of <context:component-scan> implicitly enables the functionality of <context:annotation-config>. There is usually no need to include the<context:annotation-config> element when using <context:component-scan>.

结论:也就是说当我们使用<context:component-scan>的时候就不需要再使用<context:annotation-config>了

转载于:https://my.oschina.net/u/1756147/blog/364843

你可能感兴趣的文章
【Nebula系列】C++反射机制:可变参数模板实现C++反射
查看>>
mac 终端 常用命令
查看>>
2016年人工智能产业梳理:一朝引爆,稳步前进(下篇)
查看>>
django 1.8 官方文档翻译:5-1-2 表单API
查看>>
区块链将会怎样颠覆Google、Amazon、Facebook和Apple?
查看>>
VR直播很火,但能取代传统电视直播吗?
查看>>
[转]区块链代码快速学习实践
查看>>
QuickBI助你成为分析师——计算字段功能
查看>>
《王牌特工2》情景再现,Youbionic推出可穿戴式机械手
查看>>
雪城大学信息安全讲义 五、竞态条件
查看>>
干货分享:MySQL之化险为夷的【钻石】抢购风暴
查看>>
量子通信能否跨越“死亡之谷”?2017年市场化的量子通信产品可能产生
查看>>
有序顺序表合并
查看>>
设计模式-观察者模式
查看>>
Spring4-自动装配Beans-按属性名称自动装配
查看>>
精通比特币系列---挖矿与共识
查看>>
to use extended Windows dialogs
查看>>
3A级VR游戏将至?汪丛青力挺G胖正在开发的三款VR游戏
查看>>
Mongodb 3.2 Manual阅读笔记:CH9 存储
查看>>
关于同一线程两次调用EnterCriticalSection的测试
查看>>