Skip to content

Commit dc78bd4

Browse files
committed
Merge pull request #42682 from quaff
* pr/42682: Strengthen package-like assertions Closes gh-42682
2 parents 98dd7b2 + 87cc2ef commit dc78bd4

File tree

6 files changed

+7
-7
lines changed

6 files changed

+7
-7
lines changed

spring-boot-project/spring-boot-actuator-autoconfigure/src/test/java/org/springframework/boot/actuate/autoconfigure/endpoint/web/documentation/EnvironmentEndpointDocumentationTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ private byte[] filterProperties(byte[] content, MediaType mediaType) {
138138
}
139139

140140
private boolean retainKey(String key) {
141-
return key.startsWith("java.") || key.equals("JAVA_HOME") || key.startsWith("com.example");
141+
return key.startsWith("java.") || key.equals("JAVA_HOME") || key.startsWith("com.example.");
142142
}
143143

144144
@Configuration(proxyBeanMethods = false)

spring-boot-project/spring-boot-docs/src/main/java/org/springframework/boot/docs/howto/dataaccess/filterscannedentitydefinitions/MyEntityScanConfiguration.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public class MyEntityScanConfiguration {
2525

2626
@Bean
2727
public ManagedClassNameFilter entityScanFilter() {
28-
return (className) -> className.startsWith("com.example.app.customer");
28+
return (className) -> className.startsWith("com.example.app.customer.");
2929
}
3030

3131
}

spring-boot-project/spring-boot-docs/src/main/kotlin/org/springframework/boot/docs/howto/dataaccess/filterscannedentitydefinitions/MyEntityScanConfiguration.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class MyEntityScanConfiguration {
2626
@Bean
2727
fun entityScanFilter() : ManagedClassNameFilter {
2828
return ManagedClassNameFilter { className ->
29-
className.startsWith("com.example.app.customer")
29+
className.startsWith("com.example.app.customer.")
3030
}
3131
}
3232
}

spring-boot-project/spring-boot-tools/spring-boot-autoconfigure-processor/src/main/java/org/springframework/boot/autoconfigureprocessor/AutoConfigureAnnotationProcessor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,7 @@ private int compare(Object o1, Object o2) {
280280
}
281281

282282
private boolean isSpringClass(String type) {
283-
return type.startsWith("org.springframework");
283+
return type.startsWith("org.springframework.");
284284
}
285285

286286
}

spring-boot-project/spring-boot-tools/spring-boot-loader-classic/src/main/java/org/springframework/boot/loader/jar/Handler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ private boolean isTomcatWarUrl(String file) {
150150
if (file.startsWith(TOMCAT_WARFILE_PROTOCOL) || !file.contains("*/")) {
151151
try {
152152
URLConnection connection = new URL(file).openConnection();
153-
if (connection.getClass().getName().startsWith("org.apache.catalina")) {
153+
if (connection.getClass().getName().startsWith("org.apache.catalina.")) {
154154
return true;
155155
}
156156
}

spring-boot-project/spring-boot-tools/spring-boot-test-support/src/main/java/org/springframework/boot/testsupport/classpath/ModifiedClassPathClassLoader.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ final class ModifiedClassPathClassLoader extends URLClassLoader {
8888

8989
@Override
9090
public Class<?> loadClass(String name) throws ClassNotFoundException {
91-
if (name.startsWith("org.junit") || name.startsWith("org.hamcrest")
92-
|| name.startsWith("io.netty.internal.tcnative")) {
91+
if (name.startsWith("org.junit.") || name.startsWith("org.hamcrest.")
92+
|| name.startsWith("io.netty.internal.tcnative.")) {
9393
return Class.forName(name, false, this.junitLoader);
9494
}
9595
String packageName = ClassUtils.getPackageName(name);

0 commit comments

Comments
 (0)