I'm learning Spring 3 and I don't seem to grasp the functionality behind <context:annotation-config>
and <context:component-scan>
. 我正在学习Spring 3,而且彷佛不太了解<context:annotation-config>
和<context:component-scan>
。 post
From what I've read they seem to handle different annotations ( @Required
, @Autowired
etc vs @Component
, @Repository
, @Service
etc), but also from what I've read they register the same bean post processor classes. 从我阅读的内容来看,它们彷佛处理不一样的注释 ( @Required
, @Repository
@Autowired
等与@Component
@Repository
, @Service
@Component
, @Repository
等),但从我阅读的内容来看,它们注册了相同的bean后处理器类。 学习
To confuse me even more, there is an annotation-config
attribute on <context:component-scan>
. 更让我感到困惑的是, <context:component-scan>
上有一个annotation-config
属性 。 ui
Can someone shed some light on these tags? 有人能够说明这些标签吗? What's similar, what's different, is one superseded by the other, they complete each other, do I need one of them, both? 有什么类似之处,有什么不一样之处,是一个被另外一个取代,它们彼此完成,我是否须要其中一个? spa