Home Tutorial Spring Spring3 Aop Pointcut NameMethodMatch using BeanFactory


Share on Google+Share on Google+
Pointcut NameMethodMatch using BeanFactory
Posted on: September 8, 2010 at 12:00 AM
In this example you will learn how to match the method name using BeanFactory.

Pointcut NameMethodMatch using BeanFactory

A pointcut is a bunch of codes that picks out join points and exposes data from the execution context of those join points.Following is an example of NameMethodMatch using springConfig.xml.


package roseindia.net.bean;

public class SimpleBean {
	String name;

	public String getName() {
		return name;

	public void setName(String name) {
		this.name = name;

	public void displayName() {
		System.out.println("Hello " + this.name);


package roseindia.net.main;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
import org.springframework.core.io.ClassPathResource;

import roseindia.net.bean.SimpleBean;

public class MainClaz {
	public static void main(String[] args) throws Exception {
		BeanFactory beanFactory = new XmlBeanFactory(new ClassPathResource(
		SimpleBean simpleBean = (SimpleBean) beanFactory.getBean("testBean");


<?xml version="1.0" encoding="UTF-8"?>

  <bean id="testBean" class="org.springframework.aop.framework.ProxyFactoryBean">
    <property name="target">
      <bean class="roseindia.net.bean.SimpleBean">
        <property name="name" value="Vinay" />
    <property name="interceptorNames">
        <idref bean="methodMatchPintcut" />
    <property name="proxyTargetClass" value="true" />
  <bean id="methodMatchPintcut"
    <property name="advice" ref="concurrencyThrottleInterceptor" />
    <property name="mappedName" value="displayName" />
  <bean id="concurrencyThrottleInterceptor"
    <property name="concurrencyLimit" value="10" />


When you run this application it will display message as shown below:

Hello Vinay

Download this example code


Related Tags for Pointcut NameMethodMatch using BeanFactory:

Follow us on Twitter, or add us on Facebook or Google Plus to keep you updated with the recent trends of Java and other open source platforms.

Posted on: September 8, 2010

Recommend the tutorial

Advertisements Advertisements