Commit 19779951 authored by Stephane Nicoll's avatar Stephane Nicoll

Handle class not found

See gh-14575
parent 0f11e69c
...@@ -121,7 +121,7 @@ public class DevToolsPropertyDefaultsPostProcessor implements EnvironmentPostPro ...@@ -121,7 +121,7 @@ public class DevToolsPropertyDefaultsPostProcessor implements EnvironmentPostPro
private boolean isWebApplication(Environment environment) { private boolean isWebApplication(Environment environment) {
for (String candidate : WEB_ENVIRONMENT_CLASSES) { for (String candidate : WEB_ENVIRONMENT_CLASSES) {
Class<?> environmentClass = ClassUtils.resolveClassName(candidate, Class<?> environmentClass = resolveClassName(candidate,
environment.getClass().getClassLoader()); environment.getClass().getClassLoader());
if (environmentClass != null && environmentClass.isInstance(environment)) { if (environmentClass != null && environmentClass.isInstance(environment)) {
return true; return true;
...@@ -130,4 +130,13 @@ public class DevToolsPropertyDefaultsPostProcessor implements EnvironmentPostPro ...@@ -130,4 +130,13 @@ public class DevToolsPropertyDefaultsPostProcessor implements EnvironmentPostPro
return false; return false;
} }
private Class<?> resolveClassName(String candidate, ClassLoader classLoader) {
try {
return ClassUtils.resolveClassName(candidate, classLoader);
}
catch (IllegalArgumentException ex) {
return null;
}
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment