core-beans.adoc (spring-framework-5.3.23) | : | core-beans.adoc (spring-framework-5.3.24) | ||
---|---|---|---|---|
skipping to change at line 9112 | skipping to change at line 9112 | |||
element. While it would be acceptable to do so, it is unnecessary, given that no other bean | element. While it would be acceptable to do so, it is unnecessary, given that no other bean | |||
ever refers to it, and it is unlikely to be explicitly fetched from the containe r by name. | ever refers to it, and it is unlikely to be explicitly fetched from the containe r by name. | |||
Similarly, the `DataSource` bean is only ever autowired by type, so an explicit bean `id` | Similarly, the `DataSource` bean is only ever autowired by type, so an explicit bean `id` | |||
is not strictly required. | is not strictly required. | |||
-- | -- | |||
.[[beans-java-combining-xml-centric-component-scan]] Using <context:component-sc an/> to pick up `@Configuration` classes | .[[beans-java-combining-xml-centric-component-scan]] Using <context:component-sc an/> to pick up `@Configuration` classes | |||
-- | -- | |||
Because `@Configuration` is meta-annotated with `@Component`, `@Configuration`-a nnotated | Because `@Configuration` is meta-annotated with `@Component`, `@Configuration`-a nnotated | |||
classes are automatically candidates for component scanning. Using the same scen ario as | classes are automatically candidates for component scanning. Using the same scen ario as | |||
describe in the previous example, we can redefine `system-test-config.xml` to ta ke advantage of component-scanning. | described in the previous example, we can redefine `system-test-config.xml` to t ake advantage of component-scanning. | |||
Note that, in this case, we need not explicitly declare | Note that, in this case, we need not explicitly declare | |||
`<context:annotation-config/>`, because `<context:component-scan/>` enables the same | `<context:annotation-config/>`, because `<context:component-scan/>` enables the same | |||
functionality. | functionality. | |||
The following example shows the modified `system-test-config.xml` file: | The following example shows the modified `system-test-config.xml` file: | |||
[source,xml,indent=0,subs="verbatim,quotes"] | [source,xml,indent=0,subs="verbatim,quotes"] | |||
---- | ---- | |||
<beans> | <beans> | |||
<!-- picks up and registers AppConfig as a bean definition --> | <!-- picks up and registers AppConfig as a bean definition --> | |||
End of changes. 1 change blocks. | ||||
1 lines changed or deleted | 1 lines changed or added |