Spring component-scan
Springcomponent-scan
<context:component-scan base-package="com.xyz"> <context:include-filter type="regex" expression="com\.xyz\.rest\.dao\..*DaoImpl" /> </context:component-scan>
Element:component-scan
Scanstheclasspathforannotatedcomponentsthatwillbeauto-registeredasSpringbeans.Bydefault,the
Spring-provided@Component,@Repository,@Service,[email protected]:
Thistagimpliestheeffectsofthe'annotation-config'tag,activating@Required,@Autowired,
@PostConstruct,@PreDestroy,@Resource,@PersistenceContextand@PersistenceUnitannotationsinthe
componentclasses,whichisusuallydesiredforautodetectedcomponents(withoutexternalconfiguration).
Turnoffthe'annotation-config'attributetodeactivatethisdefaultbehavior,forexampleinordertouse
customBeanPostProcessordefinitionsforhandlingthoseannotations.Note:Youmayuseplaceholdersin
packagepaths,butonlyresolvedagainstsystemproperties(analogoustoresourcepaths).Acomponent
scanresultsinnewbeandefinitionbeingregistered;Spring'sPropertyPlaceholderConfigurerwillapplyto
thosebeandefinitionsjustliketoregularbeandefinitions,butitwon'tapplytothecomponentscan
settingsthemselves.Seejavadocfororg.springframework.context.annotation.ComponentScanfor
informationoncode-basedalternativestobootstrappingcomponent-scanning.
ContentModel:(include-filter*,exclude-filter*)