MCQs Test!! VB Basic Test !! Essentials of VB !! Creating User Services !! function !! Anatomy !! GK March-2019 !! DATA TYPES IN JAVA !! Classes ,Constructor ,Methods,Inheritance !! Ecology-I !! Biology 2019 !! Gk april 2019 !! Biology (living world) !! Plant anatomy !! CELL STRUCTURES AND FUNCTION !! General biology !! Human physiology !! Data structure !! Ecology-II !! GK TEST !! Reproduction in plants !! Human reproduction !! The ABC of C !! Operating system set1 !! Operating system set2 !! Gk and current affairs !! Animal kingdom !! Number system !! Animal kingdom-II !! Gk TEST-III !! Number series !! Microorganisms !! Interview question in c !! Time and Work !! Percentage !! General history !! Average !! Cells !! Locomotion and Movement !! paging !! Bacteriology !! Page replacement policy !! Secondary memory and Disk scheduling !! Introduction of Nervous System and neurons !! Plant harmones !! Transport and Mineral Nutrition in Plants !! Neurotransmitters !! Modern Indian History !! Photosynthesis in Plants !! Modern Indian History-II !! Plant respiration !! Environment & Biodiversity !! Environment & Biodiversity - II !! Algae, Bryophytes, Pteridophytes !! Area !! Cricket !! Days of the Year (India and the World) !! Plant Pathology - I !! Indian Transport System !! Plant Pathology - II !! Aptitude !! Biology !! Botany !! C language !! Computer Science !! Core Java !! Gate !! GK !! Mysql !! Operating system !! Physics !! VB-Visual Basic !! Zoology

Spring Framework

Spring Projects

Spring Project 1

Example of NameMatchMethodPointcut
Previous Home Next

Introduction: This pointcut implementation uses method name as criteria of finding out the applicability of advices. The pointcut simply specify a which method of a bean can be advice is does not specified the advices. Advices are associated to pointcut with the help of aspect implementation of aspect is called advisor in Spring AOP implementation framework provide predefine advisor. Most commonly used one these are before pointcut advisor.

Technology use to run this source code

  1. Spring 2.5 jar files
  2. Eclipse IDE
  3. Tomcat Server

Source Code:


<?xml version="1.0" encoding="UTF-8"?>
<bean id="t" class="org.r4r.One"/>
<bean id="a1" class="org.r4r.BeforeAdvisor"/>
<bean id="a2" class="org.r4r.AfterAdvisor"/>
<bean id="pc1" class="">
<property name="mappedName" value="a"/>
<bean id="pc2" class="">
<property name="mappedName" value="b"/>
<bean id="ad1" class="">
<property name="advice" ref="a1"/>
<property name="pointcut" ref="pc1"/>
<bean id="ad2" class="">
<property name="advice" ref="a2"/>
<property name="pointcut" ref="pc2"/>
<bean id="proxy" class="org.springframework.aop.framework.ProxyFactoryBean">
<property name="target" ref="t"/>
<property name="interceptorNames">

package org.r4r;
public interface AB {
public void a();
public void b();


package org.r4r;
public class One implements AB {
public void a() {
System.out.println("a() of one invoked");
public void b() {
System.out.println("b() of one invoked");

package org.r4r;
import java.lang.reflect.Method;
import org.springframework.aop.AfterReturningAdvice;
public class AfterAdvisor implements AfterReturningAdvice {
public void afterReturning(Object arg0, Method arg1, Object[] arg2,
Object arg3) throws Throwable {
System.out.println("After advisor is provide service..");

package org.r4r;
import java.lang.reflect.Method;
import org.springframework.aop.MethodBeforeAdvice;
public class BeforeAdvisor implements MethodBeforeAdvice {
public void before(Method arg0, Object[] arg1, Object arg2)
throws Throwable {
System.out.println("Before advice is applied..");

package org.r4r;
import org.springframework.beans.factory.BeanFactory;
import org.springframework.beans.factory.xml.XmlBeanFactory;
public class ProxyTest {
public static void main(String[] args) {
Resource r=new ClassPathResource("applicationContext.xml");
BeanFactory f=new XmlBeanFactory(r);
AB proxy=(AB)f.getBean("proxy");
System.out.println("Proxy obtained invoking a().");
System.out.println("Proxy obtained invoking b()");


Proxy obtained invoking a().
Before advice is applied..
a() of one invoked
Proxy obtained invoking b()
b() of one invoked
After advisor is provide service..
Previous Home Next