Skip to content

Strengthen package-like assertions #42682

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ private byte[] filterProperties(byte[] content, MediaType mediaType) {
}

private boolean retainKey(String key) {
return key.startsWith("java.") || key.equals("JAVA_HOME") || key.startsWith("com.example");
return key.startsWith("java.") || key.equals("JAVA_HOME") || key.startsWith("com.example.");
}

@Configuration(proxyBeanMethods = false)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class MyEntityScanConfiguration {

@Bean
public ManagedClassNameFilter entityScanFilter() {
return (className) -> className.startsWith("com.example.app.customer");
return (className) -> className.startsWith("com.example.app.customer.");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class MyEntityScanConfiguration {
@Bean
fun entityScanFilter() : ManagedClassNameFilter {
return ManagedClassNameFilter { className ->
className.startsWith("com.example.app.customer")
className.startsWith("com.example.app.customer.")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ private int compare(Object o1, Object o2) {
}

private boolean isSpringClass(String type) {
return type.startsWith("org.springframework");
return type.startsWith("org.springframework.");
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ private boolean isTomcatWarUrl(String file) {
if (file.startsWith(TOMCAT_WARFILE_PROTOCOL) || !file.contains("*/")) {
try {
URLConnection connection = new URL(file).openConnection();
if (connection.getClass().getName().startsWith("org.apache.catalina")) {
if (connection.getClass().getName().startsWith("org.apache.catalina.")) {
return true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ final class ModifiedClassPathClassLoader extends URLClassLoader {

@Override
public Class<?> loadClass(String name) throws ClassNotFoundException {
if (name.startsWith("org.junit") || name.startsWith("org.hamcrest")
|| name.startsWith("io.netty.internal.tcnative")) {
if (name.startsWith("org.junit.") || name.startsWith("org.hamcrest.")
|| name.startsWith("io.netty.internal.tcnative.")) {
return Class.forName(name, false, this.junitLoader);
}
String packageName = ClassUtils.getPackageName(name);
Expand Down
Loading