Get all updates of Java4s
Follow Us: Email Newsletter

RegularExpressionMethodPointcut Class In Spring AOP

Spring » On Sep 21, 2012 { 5 Comments } 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.

  ♦ About Author ♦

Java4s_Author
sivateja@java4s.com
Full Stack( Java/J2EE & UI/UX ) Developer and founder of Java4s - Get It Yourself, A popular Java/J2EE Programming Blog. Sign-up for the Email Newsletter for your daily dose of Java tutorials.

Comments

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).

Name*
Mail*
Website



By posting your answer, you agree to our comments policy.
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_Logo Hibernate Recent Posts Spring_Logo Spring Recent Posts Struts_Logo Struts Recent Posts
Useful Links Current & UpComing Tutorials
Upcoming
  Web Services [ SOAP ], JSP
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.