6.1Spring的AOP的解析——AOP的自定义组件

2019-02-12  本文已影响0人  szhlcy

 前面说过了spring的Schema扩展支持,可以看这里3.1Spring源码解析——自定义标签的使用,这里就不在进行多余的复述了。
 前面讲过,Spring支持自定义的扩展组件,但是必须以下两点

 对应的文件的解析类可以在META-INF文件夹的Spring.handlers中可以找到
 在代码中对定义的Aspect的注解进行解析的类为AopNamespaceHandler:

    public void init() {
        // In 2.0 XSD as well as in 2.1 XSD.
        registerBeanDefinitionParser("config", new ConfigBeanDefinitionParser());
        registerBeanDefinitionParser("aspectj-autoproxy", new AspectJAutoProxyBeanDefinitionParser());
        registerBeanDefinitionDecorator("scoped-proxy", new ScopedProxyBeanDefinitionDecorator());

        // Only in 2.0 XSD: moved to context namespace as of 2.1
        registerBeanDefinitionParser("spring-configured", new SpringConfiguredBeanDefinitionParser());
    }

在解析配置文件的时候,一旦遇到aspectj-autoproxy注解时就会使用解析器AspectJAutoProxyBeanDefinitionParser进行解析。
&esmp;下一篇Spring的AOP的解析——AnnotationAwareAspectJAutoProxyCreator

上一篇下一篇

猜你喜欢

热点阅读