Support lenient ContainerConnectionDetailsFactory hint registration

Update `ContainerConnectionDetailsFactory` hint registration logic
so that types are optional on the classpath.

See gh-36606
Fixes gh-38392
This commit is contained in:
Phillip Webb
2023-11-20 15:50:06 -08:00
parent 6229d5de3d
commit f68df82b30
13 changed files with 123 additions and 32 deletions

View File

@@ -20,6 +20,7 @@ import java.io.File;
import java.lang.management.ManagementFactory;
import java.lang.reflect.AnnotatedElement;
import java.lang.reflect.Method;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.net.URLClassLoader;
@@ -297,7 +298,10 @@ final class ModifiedClassPathClassLoader extends URLClassLoader {
private boolean isExcluded(URL url) {
if ("file".equals(url.getProtocol())) {
try {
String name = new File(url.toURI()).getName();
URI uri = url.toURI();
File file = new File(uri);
String name = (!uri.toString().endsWith("/")) ? file.getName()
: file.getParentFile().getParentFile().getName();
for (String exclusion : this.exclusions) {
if (this.matcher.match(exclusion, name)) {
return true;