Create MetadataReaderFactory instances with factory methods
Prior to this commit, Spring would create directly `SimpleMetadataReaderFactory` instances or would manually create `CachingMetadataReaderFactory` which extend `SimpleMetadataReaderFactory`. This would prevent usage of the new `ClassFileMetadataReaderFactory` in our internal codebase. This commit replaces manual instantiations with calls to `MetadataReaderFactory` factory methods and makes `CachingMetadataReaderFactory` delegate to another factory created with the same factory methods. This allows internal usage of `ClassFileMetadataReaderFactory` internally. Closes gh-33616
This commit is contained in:
@@ -83,7 +83,6 @@ import org.springframework.core.annotation.MergedAnnotations;
|
||||
import org.springframework.core.type.AnnotationMetadata;
|
||||
import org.springframework.core.type.MethodMetadata;
|
||||
import org.springframework.core.type.classreading.MetadataReaderFactory;
|
||||
import org.springframework.core.type.classreading.SimpleMetadataReaderFactory;
|
||||
import org.springframework.javapoet.ClassName;
|
||||
import org.springframework.javapoet.CodeBlock;
|
||||
import org.springframework.lang.Nullable;
|
||||
@@ -284,7 +283,7 @@ public class AutowiredAnnotationBeanPostProcessor implements SmartInstantiationA
|
||||
"AutowiredAnnotationBeanPostProcessor requires a ConfigurableListableBeanFactory: " + beanFactory);
|
||||
}
|
||||
this.beanFactory = clbf;
|
||||
this.metadataReaderFactory = new SimpleMetadataReaderFactory(clbf.getBeanClassLoader());
|
||||
this.metadataReaderFactory = MetadataReaderFactory.create(clbf.getBeanClassLoader());
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user