Spring框架ASM字节码提升

ASM字节码提升流程

  • MetadataReader
    接口唯一内部实现类 SimpleMetadataReader 门面接口访问元信息
    由工厂类SimpleMetadataReaderFactory产生 工厂模式
    读取通过ASM来自ClassReader解析器,得到ClassMetadata元数据

  • SimpleMetadataReader:门面设计接口,可以得到元信息 门面模式
    org.springframework.core.type.classreading.MetadataReader#getAnnotationMetadata
    由访问者对象中的org.springframework.core.type.classreading.SimpleAnnotationMetadataReadingVisitor创建

  • ClassReader字节码文件解析器 访问者模式
    resource-》ClassReader#accept()-》SimpleAnnotationMetadataReadingVisitor#visit创建AnnotationMetadata的实例

  • StandardAnnotationMetadata(StandardClassMetadata) 通过反射获得的元信息

原文地址:https://www.cnblogs.com/windlog/p/13879601.html