Skip to content

Commit 837cb75

Browse files
committed
Clarify component scan include-filter semantics
Issue: SPR-13844
1 parent ebad8db commit 837cb75

File tree

3 files changed

+14
-5
lines changed

3 files changed

+14
-5
lines changed

spring-context/src/main/java/org/springframework/context/annotation/ComponentScan.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -127,10 +127,13 @@
127127

128128
/**
129129
* Specifies which types are eligible for component scanning.
130-
* <p>Further narrows the set of candidate components from everything in
131-
* {@link #basePackages} to everything in the base packages that matches
132-
* the given filter or filters.
133-
* @see #resourcePattern
130+
* <p>Further narrows the set of candidate components from everything in {@link #basePackages}
131+
* to everything in the base packages that matches the given filter or filters.
132+
* <p>Note that these filters will be applied in addition to the default filters, if specified.
133+
* Any type under the specified base packages which matches a given filter will be included,
134+
* even if it does not match the default filters (i.e. is not annotated with {@code @Component}).
135+
* @see #resourcePattern()
136+
* @see #useDefaultFilters()
134137
*/
135138
Filter[] includeFilters() default {};
136139

spring-context/src/main/resources/org/springframework/context/config/spring-context-4.2.xsd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,9 @@
235235
<xsd:annotation>
236236
<xsd:documentation><![CDATA[
237237
Controls which eligible types to include for component scanning.
238+
Note that these filters will be applied in addition to the default filters, if specified.
239+
Any type under the specified base packages which matches a given filter will be included,
240+
even if it does not match the default filters (i.e. is not annotated with @Component).
238241
]]></xsd:documentation>
239242
</xsd:annotation>
240243
</xsd:element>

spring-context/src/main/resources/org/springframework/context/config/spring-context-4.3.xsd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,6 +235,9 @@
235235
<xsd:annotation>
236236
<xsd:documentation><![CDATA[
237237
Controls which eligible types to include for component scanning.
238+
Note that these filters will be applied in addition to the default filters, if specified.
239+
Any type under the specified base packages which matches a given filter will be included,
240+
even if it does not match the default filters (i.e. is not annotated with @Component).
238241
]]></xsd:documentation>
239242
</xsd:annotation>
240243
</xsd:element>

0 commit comments

Comments
 (0)