Declaring a point-cut

Just to recall, a join-point is a place where we want to apply Advice, and a point-cut represents a pattern of matching join-points. A point-cut must be defined within the <aop:config> element. A point-cut can be declared within the <aop:aspect> element or outside of it. If it's defined outside of <aop:aspect>, it can be shared between multiple aspects and advisors.

A point-cut allows Advice to be applied to the target object independently of the object-oriented hierarchy. Transaction management through AOP Advice in Spring is a real example of where transaction Advice is applied to specific methods (add/update/delete methods) that span multiple object hierarchies. This snippet is one of the possible ways of writing a point-cut:

    <aop:pointcut id="employeeServiceMethods"
expression="execution(* com.packet.spring.aop.service.*.*(..))" />

A point-cut is uniquely identified by its id attribute. The expression attribute represents the pattern (or filter) of matching join-points. The value of the expression attribute consists of two components:

  • Point-cut designator
  • Pattern
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.71.106