– 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,
<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.