RegularExpressionMethodPointcut Class In Spring AOP

Spring » On Sep 21, 2012 By Sivateja

RegularExpressionMethodPointcut class is going to verify whether the method name of the class is matching with the given regular expression or not.  If matches then those methods are eligible to get Advices.  While configuring these classes into xml file, we are going to configure any one of following 2 properties..

  • pattern
  • patterns

some thing…

According to above configuration, a method name should start with get, and between get and letter N there should be one or more characters and finally that should end with a digit.  If method name satisfies this pattern then it is eligible for getting advices.

While working with regular expressions, we have following indications..
  – matches for single character
.* – matches for zero [or] more characters
.+ – matches for 1 [or] more characters
.? – matches for zero [or] 1 character
[A-Z] – matches for an upper case alphabet
[abc] – matches for either a or b or c
[0-9] – matches for a digit

If we want to configure multiple regular expressions then we need to configure patterns property with list as NameMatchMethodPointcut, will see the example in the next article.

Java/J2EE Developer & Web Designer, founder of Sign-up for the email newsletter for your daily dose of Java tutorials.


5 Responses to “RegularExpressionMethodPointcut Class In Spring AOP”
  1. sridhar says:

    Thanks to java4s for giving the wonderful tutorial.But where is the rest of the topics in Spring AOP i.e., Dynamic PointCut etc..???Am excepting you to finish this AOP Tutorial ASAP.

  2. debasish says:

    Where is the rest of the part….it is really good..but need to complete rest of the topic with detailed example and explanation

  3. prasad says:

    good website.
    please post dynamic pointcut in aop of spring framework

  4. pandu says:

    please post in what are the ways to integrate spring with hibernate and explain them?
    from my analysis 2 ways
    1. by using hibernate template class
    2. by using MVC with DAO design pattern
    please tell me other ways

  5. nath says:

    Hi Sivateja…. Nice website for easy learning as you website tag line saying “get it your self”. :-)

    You said at starting there are 9 concepts in AOP (Aspect,Advice,JoinPoint,Pointcut,Introduction,Target,Proxy,Weaving,Adviser), so far we covered 4 concepts only. What about other concepts? those not much used or you are going to cover those soon?

    looking ahead for remaining concepts(Introduction,Target,Proxy,Weaving,Adviser).


By posting your answer, you agree to our comments policy.
© 2010 - 2016
Java4s - Get It Yourself.
The content & design is copyrighted to Sivateja Kandula, it may not be reproduced on other websites.
What would you like to learn today?
Browse these popular technologies
Hibernate spring struts Servlets ajax Log4j jQuery Json Core Java Web Services AngularJs

Most Recent Tutorials
Hibernate Recent Posts
Spring Recent Posts
Struts Recent Posts
Recomandded Links
Current & UpComing Tutorials
  Web Services [ SOAP ], JSP
Facebook_Java4s  Twitter_Java4s  GooglePlus_Java4s  Youtube_Java4s 
Contact | About Us | Privacy Policy | Advertise With Us

© 2010 - 2016 Java4s - Get It Yourself.
The content is copyrighted to Sivateja Kandula and may not be reproduced on other websites.