@@ -323,11 +323,29 @@ sure that they are 'opened' (that is, that they use an `opens` declaration inste
323323`exports` declaration in your `module-info` descriptor). 
324324==== 
325325
326- ==== Property placeholders and Ant-style patterns
326+ Furthermore, the `AutowiredAnnotationBeanPostProcessor` and
327+ `CommonAnnotationBeanPostProcessor` are both implicitly included when you use the
328+ `<context:component-scan>` element. That means that the two components are autodetected
329+ and wired together -- all without any bean configuration metadata provided in XML.
330+ 
331+ NOTE: You can disable the registration of `AutowiredAnnotationBeanPostProcessor` and
332+ `CommonAnnotationBeanPostProcessor` by including the `annotation-config` attribute
333+ with a value of `false`.
334+ 
335+ 
336+ [[beans-scanning-placeholders-and-patterns]]
337+ === Property Placeholders and Ant-style Patterns
338+ 
339+ The `basePackages` and `value` attributes in `@ComponentScan` support `${...}` property
340+ placeholders which are resolved against the `Environment` as well as Ant-style package
341+ patterns such as `"org.example.+++**+++"`.
342+ 
343+ In addition, multiple packages or patterns may be specified, either separately or within
344+ a single String — for example, `{"org.example.config", "org.example.service.+++**+++"}`
345+ or `"org.example.config, org.example.service.+++**+++"`.
327346
328- `@ComponentScan(basePackages)` supports `${…}` property placeholders resolved
329- against the `Environment` and Ant-style package patterns such as `com.example.**`.
330- Multiple packages and/or patterns may be specified.
347+ The following example specifies the `app.scan.packages` property placeholder for the
348+ implicit `value` attribute in `@ComponentScan`.
331349
332350[tabs]
333351====== 
@@ -336,41 +354,36 @@ Java::
336354[source,java,indent=0,subs="verbatim,quotes"] 
337355---- 
338356@Configuration 
339- @ComponentScan(basePackages =  "${app.scan.packages}") 
357+ @ComponentScan("${app.scan.packages}") // <1>  
340358public class AppConfig { 
341359	// ... 
342360} 
343361---- 
362+ <1> `app.scan.packages` property placeholder to be resolved against the `Environment` 
344363
345364Kotlin:: 
346365+ 
347366[source,kotlin,indent=0,subs="verbatim,quotes"] 
348367---- 
349368@Configuration 
350- @ComponentScan(basePackages =  ["\${app.scan.packages}"]) 
369+ @ComponentScan(["\${app.scan.packages}"]) // <1>  
351370class AppConfig { 
352371	// ... 
353372} 
354373---- 
374+ <1> `app.scan.packages` property placeholder to be resolved against the `Environment` 
355375====== 
356376
377+ The following listing represents a properties file which defines the `app.scan.packages`
378+ property. In the preceding example, it is assumed that this properties file has been
379+ registered with the `Environment` – for example, via `@PropertySource` or a similar
380+ mechanism.
381+ 
357382[source,properties,indent=0,subs="verbatim,quotes"]
358383---- 
359- app.scan.packages=com .example.**, org.acme. * 
384+ app.scan.packages=org .example.config,  org.example.service.* * 
360385---- 
361386
362- NOTE: Ant-style patterns do not apply to `basePackageClasses`, which accepts concrete
363- classes and derives packages from those classes.
364- 
365- Furthermore, the `AutowiredAnnotationBeanPostProcessor` and
366- `CommonAnnotationBeanPostProcessor` are both implicitly included when you use the
367- component-scan element. That means that the two components are autodetected and
368- wired together -- all without any bean configuration metadata provided in XML.
369- 
370- NOTE: You can disable the registration of `AutowiredAnnotationBeanPostProcessor` and
371- `CommonAnnotationBeanPostProcessor` by including the `annotation-config` attribute
372- with a value of `false`.
373- 
374387
375388[[beans-scanning-filters]]
376389== Using Filters to Customize Scanning
0 commit comments