<上下文:批注-配置>与<上下文:组件-扫描>之间的区别我正在学习Spring 3,我似乎没有掌握它背后的功能<context:annotation-config>和<context:component-scan>.从我所读到的内容来看,它们似乎处理了不同的注释(@Required、@Autored等与@Component、@Repository、@Service等),但从我所读到的内容来看,它们也注册了相同的bean后处理器类。更让我困惑的是annotation-config属性<context:component-scan>.有人能弄清楚这些标签吗?什么是相似的,什么是不同的,一个被另一个取代,他们相互完善,我是否需要其中之一,两者兼而有之?
3 回答

陪伴而非守候
TA贡献1757条经验 获得超8个赞
<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/>
添加回答
举报
0/150
提交
取消