All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.springframework.aop.config.AopNamespaceHandler Maven / Gradle / Ivy

There is a newer version: 5.3.34
Show newest version
/*
 * Copyright 2002-2007 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
 *
 *      http://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;

/**
 * NamespaceHandler for the aop namespace.
 *
 * 

Provides a {@link org.springframework.beans.factory.xml.BeanDefinitionParser} for the * <aop:config> tag. A config tag can include nested * pointcut, advisor and aspect tags. * *

The pointcut tag allows for creation of named * {@link AspectJExpressionPointcut} beans using a simple syntax: *

 * <aop:pointcut id="getNameCalls" expression="execution(* *..ITestBean.getName(..))"/>
 * 
* *

Using the 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 advisor tag supports both in-line and referenced * {@link org.springframework.aop.Pointcut Pointcuts}: * *

 * <aop:advisor id="getAgeAdvisor"
 *     pointcut="execution(* *..ITestBean.getAge(..))"
 *     advice-ref="getAgeCounter"/>
 *
 * <aop:advisor id="getNameAdvisor"
 *     pointcut-ref="getNameCalls"
 *     advice-ref="getNameCounter"/>
* * @author Rob Harrop * @author Adrian Colyer * @author Rod Johnson * @since 2.0 */ public class AopNamespaceHandler extends NamespaceHandlerSupport { /** * Register the {@link BeanDefinitionParser BeanDefinitionParsers} for the * 'config', 'spring-configured', 'aspectj-autoproxy' * and 'scoped-proxy' tags. */ public void init() { registerBeanDefinitionParser("config", new ConfigBeanDefinitionParser()); registerBeanDefinitionParser("spring-configured", new SpringConfiguredBeanDefinitionParser()); registerBeanDefinitionParser("aspectj-autoproxy", new AspectJAutoProxyBeanDefinitionParser()); registerBeanDefinitionDecorator("scoped-proxy", new ScopedProxyBeanDefinitionDecorator()); } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy