狐的傳說(shuō)
2019-06-25 11:15:27
<上下文:批注-配置>與<上下文:組件-掃描>之間的區(qū)別我正在學(xué)習(xí)Spring 3,我似乎沒(méi)有掌握它背后的功能<context:annotation-config>和<context:component-scan>.從我所讀到的內(nèi)容來(lái)看,它們似乎處理了不同的注釋(@Required、@Autored等與@Component、@Repository、@Service等),但從我所讀到的內(nèi)容來(lái)看,它們也注冊(cè)了相同的bean后處理器類。更讓我困惑的是annotation-config屬性<context:component-scan>.有人能弄清楚這些標(biāo)簽嗎?什么是相似的,什么是不同的,一個(gè)被另一個(gè)取代,他們相互完善,我是否需要其中之一,兩者兼而有之?
3 回答

陪伴而非守候
TA貢獻(xiàn)1757條經(jīng)驗(yàn) 獲得超8個(gè)贊
<context:component-scan/>
<context:annotation-config/>
@Component
,@Service
,@Repository
,@Controller
,@Endpoint
@Configuration
,@Bean
,@Lazy
,@Scope
,@Order
,@Primary
,@Profile
,@DependsOn
,@Import
,@ImportResource
<context:component-scan/>
<context:annotation-config/>
添加回答
舉報(bào)
0/150
提交
取消