From 837cb752a41131e872bdea0355dd6d2096a995e3 Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Mon, 25 Jan 2016 20:24:26 +0100 Subject: [PATCH] Clarify component scan include-filter semantics Issue: SPR-13844 --- .../context/annotation/ComponentScan.java | 13 ++++++++----- .../context/config/spring-context-4.2.xsd | 3 +++ .../context/config/spring-context-4.3.xsd | 3 +++ 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/spring-context/src/main/java/org/springframework/context/annotation/ComponentScan.java b/spring-context/src/main/java/org/springframework/context/annotation/ComponentScan.java index 0c4f43660c..340348cc01 100644 --- a/spring-context/src/main/java/org/springframework/context/annotation/ComponentScan.java +++ b/spring-context/src/main/java/org/springframework/context/annotation/ComponentScan.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2015 the original author or authors. + * Copyright 2002-2016 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -127,10 +127,13 @@ public @interface ComponentScan { /** * Specifies which types are eligible for component scanning. - *

Further narrows the set of candidate components from everything in - * {@link #basePackages} to everything in the base packages that matches - * the given filter or filters. - * @see #resourcePattern + *

Further narrows the set of candidate components from everything in {@link #basePackages} + * to everything in the base packages that matches the given filter or filters. + *

Note that these filters will be applied in addition to the default filters, if specified. + * Any type under the specified base packages which matches a given filter will be included, + * even if it does not match the default filters (i.e. is not annotated with {@code @Component}). + * @see #resourcePattern() + * @see #useDefaultFilters() */ Filter[] includeFilters() default {}; diff --git a/spring-context/src/main/resources/org/springframework/context/config/spring-context-4.2.xsd b/spring-context/src/main/resources/org/springframework/context/config/spring-context-4.2.xsd index a70b8097c1..ad9700246e 100644 --- a/spring-context/src/main/resources/org/springframework/context/config/spring-context-4.2.xsd +++ b/spring-context/src/main/resources/org/springframework/context/config/spring-context-4.2.xsd @@ -235,6 +235,9 @@ diff --git a/spring-context/src/main/resources/org/springframework/context/config/spring-context-4.3.xsd b/spring-context/src/main/resources/org/springframework/context/config/spring-context-4.3.xsd index b10438f051..0a3c1952e0 100644 --- a/spring-context/src/main/resources/org/springframework/context/config/spring-context-4.3.xsd +++ b/spring-context/src/main/resources/org/springframework/context/config/spring-context-4.3.xsd @@ -235,6 +235,9 @@