Use MethodInvocationInfo class loader in case of JDK platform loader as well

Closes gh-30210
This commit is contained in:
Juergen Hoeller
2023-03-29 13:46:18 +02:00
parent 66cdf43b56
commit 491ae1e3be
2 changed files with 34 additions and 12 deletions

View File

@@ -780,7 +780,9 @@ public class MvcUriComponentsBuilder {
else if (controllerType.isInterface()) {
ClassLoader classLoader = controllerType.getClassLoader();
if (classLoader == null) { // JDK interface type from bootstrap loader
if (classLoader == null || classLoader.getParent() == null) {
// JDK interface type from bootstrap loader or platform loader ->
// use higher-level loader which can see Spring infrastructure classes
classLoader = MethodInvocationInfo.class.getClassLoader();
}
Class<?>[] ifcs = new Class<?>[] {controllerType, MethodInvocationInfo.class};