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