Add ClassFile variant for class metadata reading
Prior to this commit, Spring Framework would use its own ASM fork to read class/method/annotation metadata from bytecode. This is typically used in configuration class parsing to build bean definitions without actually loading classes at runtime at that step. This commit adds support for a new metadata reading implementation that uses the ClassFile API available as of Java 24. For now, this is turned on by default for Java 24+. Closes gh-33616
This commit is contained in:
@@ -84,7 +84,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.util.Assert;
|
||||
@@ -271,7 +270,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