Skip to content

Commit 113b9d1

Browse files
NeatGuyCodingsbrannen
authored andcommitted
Fix non-pattern package prefix check in CandidateComponentsIndex
Prior to this commit, the non-pattern package prefix check used packageName.startsWith(basePackage) which incorrectly treats "com.example2.foo" as a subpackage of "com.example". Closes gh-35601 Signed-off-by: NeatGuyCoding <15627489+NeatGuyCoding@users.noreply.github.com>
1 parent 51d6e8b commit 113b9d1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

spring-context/src/main/java/org/springframework/context/index/CandidateComponentsIndex.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ private static boolean matchPackage(String basePackage, String packageName) {
150150
return pathMatcher.match(basePackage, packageName);
151151
}
152152
else {
153-
return packageName.startsWith(basePackage);
153+
return packageName.equals(basePackage) || packageName.startsWith(basePackage + ".");
154154
}
155155
}
156156

0 commit comments

Comments
 (0)