Tags

links:
http://www.tutorialspoint.com/spring/aop_with_spring.htm
http://www.javaranch.com/jeanne/Spring_3_Certification_Study_Notes.pdf
http://static.springsource.org/spring/docs/3.0.x/reference/aop.html
http://docs.spring.io/spring/docs/3.0.x/spring-framework-reference/html/aop.html

summary:
– Aspect = “A”dvices + “P”oint”C”uts
– pointcuts are expressions (or patterns)
– Spring AOP is a simple AOP having limitation, only for methods, limited pointcut syntax, doesn’t get called if caller and callee are methods in same class
– Spring AOP is implemented in pure Java, no need for a special compilation
– Spring AOP does not need to control the class loader hierarchy, and is thus suitable for use in a Servlet container or application server
– Spring AOP uses dynamic proxies for aspect weaving (aka AOP proxies)
– AspectJ on the other hand uses byte code modification for aspect weaving
– AspectJ first verion 1995 full-blown AOP
– Spring AOP defaults to using standard dynamic proxies for AOP proxies. This enables any interface (or set of interfaces) to be proxied. Spring AOP can also use CGLIB proxies.
– Spring AOP with Java 5+ supports Annotation, else using XML approach,
e.g.

<aop:config>
  <aop:aspect ref="propertyChangeTracker">
    <aop:before pointcut="execution(void set*(*))" method="trackChange"/>
  </aop:aspect>
</aop:config>

<bean id="propertyChagneTracker" class="sample.PropertyChangeTracker"/>

 

– Starting Spring 2.0 interprets the same annotations as AspectJ 5, using a library supplied by AspectJ for pointcut parsing and matching. The AOP runtime is still pure Spring AOP though, and there is no dependency on the AspectJ compiler or weaver.

Advertisements