You can view the tutorials best in Google Chrome, Mozilla Firefox, Opera, higher version of Internet Explorer

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.






By [ Java/J2EE Developer & Web Designer ]
Founder of Java4s.com - Indian, lives in United States. You can contact me at sivateja [at] java4s.com
Follow me on


Comments

3 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

Name*
Mail*
Website



By posting your answer, you agree to our comments policy.
Most Recent Tutorials
Hibernate Recent Posts
Spring Recent Posts
Struts Recent Posts
Recomandded Links
Current & UpComing Tutorials
Sitemap :
spring Hibernate struts Json Ajax Log4j Log4j coreJava Servlets Web Services


Upcoming
  Web Services [ In Progress ], JSP
Facebook_Java4s  Twitter_Java4s  GooglePlus_Java4s  Youtube_Java4s 
© 2010 - 2014 Java4s - Get It Yourself.
The content is copyrighted to Sivateja Kandula and may not be reproduced on other websites.