Skip to content

Commit d152259

Browse files
committed
Clarify component scan include-filter semantics
Issue: SPR-13844 (cherry picked from commit 837cb75)
1 parent 14babb7 commit d152259

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-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.
@@ -125,10 +125,13 @@
125125

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

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>

0 commit comments

Comments
 (0)