element <component-scan> (global)
Namespace: |
|
Type: |
|
Content: |
|
Defined: |
|
Includes: |
|
Used: |
never |
Content Model Diagram
XML Representation Summary |
<component-scan |
|
|
= |
xsd:string |
|
= |
xsd:string |
|
= |
xsd:boolean : "true" |
|
= |
xsd:boolean : "true" |
|
= |
xsd:string |
|
= |
xsd:string |
|
= |
("no" | "interfaces" | "targetClass") |
|
|
> |
|
|
</component-scan> |
Content model elements (2):
-
Annotation
Scans the classpath for annotated components that will be auto-registered as
Spring beans. By default, the Spring-provided @Component, @Repository,
@Service, and @Controller stereotypes will be detected.
Note: This tag implies the effects of the 'annotation-config' tag, activating @Required,
@Autowired, @PostConstruct, @PreDestroy, @Resource, @PersistenceContext and @PersistenceUnit
annotations in the component classes, which is usually desired for autodetected components
(without external configuration). Turn off the 'annotation-config' attribute to deactivate
this default behavior, for example in order to use custom BeanPostProcessor definitions
for handling those annotations.
Note: You may use placeholders in package paths, but only resolved against system
properties (analogous to resource paths). A component scan results in new bean definition
being registered; Spring's PropertyPlaceholderConfigurer will apply to those bean
definitions just like to regular bean definitions, but it won't apply to the component
scan settings themselves.
See Javadoc for org.springframework.context.annotation.ComponentScan for information
on code-based alternatives to bootstrapping component-scanning.
XML Source (w/o annotations (10); see within schema source)
<xsd:element name="component-scan"> <xsd:complexType> <xsd:sequence> </xsd:sequence> <xsd:attribute name="base-package" type="xsd:string" use="required"/> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:enumeration value="no"/> <xsd:enumeration value="interfaces"/> <xsd:enumeration value="targetClass"/> </xsd:restriction> </xsd:simpleType> </xsd:attribute> </xsd:complexType> </xsd:element> |
Attribute Detail (all declarations; defined within this component only; 7/7) annotation-config -
Type: |
xsd:boolean, predefined |
Use: |
optional |
Indicates whether the implicit annotation post-processors should be enabled. Default is "true".
Attribute Value
XML Source (w/o annotations (1); see within schema source)
base-package -
Type: |
xsd:string, predefined |
Use: |
required |
The comma-separated list of packages to scan for annotated components.
XML Source (w/o annotations (1); see within schema source)
<xsd:attribute name="base-package" type="xsd:string" use="required"/> |
name-generator -
Type: |
xsd:string, predefined |
Use: |
optional |
The fully-qualified class name of the BeanNameGenerator to be used for naming detected components.
XML Source (w/o annotations (1); see within schema source)
resource-pattern -
Type: |
xsd:string, predefined |
Use: |
optional |
Controls the class files eligible for component detection. Defaults to "**/*.class", the recommended value.
Consider use of the include-filter and exclude-filter elements for a more fine-grained approach.
XML Source (w/o annotations (1); see within schema source)
scope-resolver -
Type: |
xsd:string, predefined |
Use: |
optional |
The fully-qualified class name of the ScopeMetadataResolver to be used for resolving the scope of
detected components.
XML Source (w/o annotations (1); see within schema source)
scoped-proxy -
Type: |
anonymous simpleType (restriction of xsd:string) |
Use: |
optional |
Indicates whether proxies should be generated for detected components, which may be necessary
when using scopes in a proxy-style fashion. Default is to generate no such proxies.
Attribute Value
enumeration of xsd:string |
Enumeration: |
"no", "interfaces", "targetClass" |
Anonymous simpleType
Type Derivation Tree xsd:string (restriction) simpleType |
Derivation: |
restriction of xsd:string |
Facets: |
enumeration: |
"no", "interfaces", "targetClass" |
|
XML Source (w/o annotations (1); see within schema source)
<xsd:attribute name="scoped-proxy"> <xsd:simpleType> <xsd:restriction base="xsd:string"> <xsd:enumeration value="no"/> <xsd:enumeration value="interfaces"/> <xsd:enumeration value="targetClass"/> </xsd:restriction> </xsd:simpleType> </xsd:attribute> |
use-default-filters -
Type: |
xsd:boolean, predefined |
Use: |
optional |
Indicates whether automatic detection of classes annotated with @Component, @Repository, @Service,
or @Controller should be enabled. Default is "true".
Attribute Value
XML Source (w/o annotations (1); see within schema source)
Content Element Detail (all declarations; defined within this component only; 2/2) -
Controls which eligible types to exclude for component scanning.
XML Source (w/o annotations (1); see within schema source)
-
Controls which eligible types to include for component scanning.
XML Source (w/o annotations (1); see within schema source)