spring AopNamespaceHandler 源码
spring AopNamespaceHandler 代码
文件路径:/spring-aop/src/main/java/org/springframework/aop/config/AopNamespaceHandler.java
/*
* Copyright 2002-2020 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* https://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.aop.config;
import org.springframework.aop.aspectj.AspectJExpressionPointcut;
import org.springframework.beans.factory.xml.BeanDefinitionParser;
import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
/**
* {@code NamespaceHandler} for the {@code aop} namespace.
*
* <p>Provides a {@link org.springframework.beans.factory.xml.BeanDefinitionParser} for the
* {@code <aop:config>} tag. A {@code config} tag can include nested
* {@code pointcut}, {@code advisor} and {@code aspect} tags.
*
* <p>The {@code pointcut} tag allows for creation of named
* {@link AspectJExpressionPointcut} beans using a simple syntax:
* <pre class="code">
* <aop:pointcut id="getNameCalls" expression="execution(* *..ITestBean.getName(..))"/>
* </pre>
*
* <p>Using the {@code advisor} tag you can configure an {@link org.springframework.aop.Advisor}
* and have it applied to all relevant beans in you {@link org.springframework.beans.factory.BeanFactory}
* automatically. The {@code advisor} tag supports both in-line and referenced
* {@link org.springframework.aop.Pointcut Pointcuts}:
*
* <pre class="code">
* <aop:advisor id="getAgeAdvisor"
* pointcut="execution(* *..ITestBean.getAge(..))"
* advice-ref="getAgeCounter"/>
*
* <aop:advisor id="getNameAdvisor"
* pointcut-ref="getNameCalls"
* advice-ref="getNameCounter"/></pre>
*
* @author Rob Harrop
* @author Adrian Colyer
* @author Juergen Hoeller
* @since 2.0
*/
public class AopNamespaceHandler extends NamespaceHandlerSupport {
/**
* Register the {@link BeanDefinitionParser BeanDefinitionParsers} for the
* '{@code config}', '{@code spring-configured}', '{@code aspectj-autoproxy}'
* and '{@code scoped-proxy}' tags.
*/
@Override
public void init() {
// In 2.0 XSD as well as in 2.5+ XSDs
registerBeanDefinitionParser("config", new ConfigBeanDefinitionParser());
registerBeanDefinitionParser("aspectj-autoproxy", new AspectJAutoProxyBeanDefinitionParser());
registerBeanDefinitionDecorator("scoped-proxy", new ScopedProxyBeanDefinitionDecorator());
// Only in 2.0 XSD: moved to context namespace in 2.5+
registerBeanDefinitionParser("spring-configured", new SpringConfiguredBeanDefinitionParser());
}
}
相关信息
相关文章
spring AbstractInterceptorDrivenBeanDefinitionDecorator 源码
spring AdvisorComponentDefinition 源码
spring AspectComponentDefinition 源码
0
赞
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦