ConfigurationClassParser consistently uses ClassUtils.forName

Issue: SPR-17253
master
Juergen Hoeller 6 years ago
parent 84ec382201
commit c803ad7998
  1. 8
      spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java

@ -90,9 +90,9 @@ import org.springframework.util.StringUtils;
* another using the {@link Import} annotation). * another using the {@link Import} annotation).
* *
* <p>This class helps separate the concern of parsing the structure of a Configuration * <p>This class helps separate the concern of parsing the structure of a Configuration
* class from the concern of registering BeanDefinition objects based on the * class from the concern of registering BeanDefinition objects based on the content of
* content of that model (with the exception of {@code @ComponentScan} annotations which * that model (with the exception of {@code @ComponentScan} annotations which need to be
* need to be registered immediately). * registered immediately).
* *
* <p>This ASM-based implementation avoids reflection and eager class loading in order to * <p>This ASM-based implementation avoids reflection and eager class loading in order to
* interoperate effectively with lazy class loading in a Spring ApplicationContext. * interoperate effectively with lazy class loading in a Spring ApplicationContext.
@ -994,7 +994,7 @@ class ConfigurationClassParser {
private SourceClass getRelated(String className) throws IOException { private SourceClass getRelated(String className) throws IOException {
if (this.source instanceof Class) { if (this.source instanceof Class) {
try { try {
Class<?> clazz = ((Class<?>) this.source).getClassLoader().loadClass(className); Class<?> clazz = ClassUtils.forName(className, ((Class<?>) this.source).getClassLoader());
return asSourceClass(clazz); return asSourceClass(clazz);
} }
catch (ClassNotFoundException ex) { catch (ClassNotFoundException ex) {

Loading…
Cancel
Save