Spring Framework

Spring Projects

Spring Project 1

Pointcut in Spring
Previous Home Next

Introduction: By simply specify advices with bean in the configuration all the method of the bean are advice some time final control is required over the application of advices i.e an application developer may want applied some advices only to the selected method to the bean.

Final control over the application of advices is provided by pointcuts. A pointcut is used by the IOC container to find out wither an advice can be applied or not. Framework provide different implementation of pointcut most commonly used implementation of which.

NameMatchMethodPointcut

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.

Following application demonstrate an user of pointcut or advisor to apply advises of selective method of bean.

 

NameMatchMethodPointcutAdvice

One of the disadvantage of using pointcuts is entry of configuration information solution of this problem is provided by PointcutAdvisor class.

A PointcutAdvisor class combined the functionality of a pointcut and advisor in to a single unit.

The NameMatchMethodPointcutAdvisor class combined the functionality of NameMatchMethodPointcut and DefaultPointcutAdvisor using this class the configuration information is reduced as follows.

Previous Home Next

Tolal:0 Click:

Show All Comments

Did not find what you were looking for leave your name and message. We will revert within 24 hours
Name:
eMail:
Comment / Feedback: