AOP for Spring

Posted on March 21, 2005

0


The industry track on Thursday started with Rob Harrop and Adrian Colyer presenting AOP for the Spring framework. Spring integrates coarse-grained proxy-based AOP into the core framework and uses it for transaction management, security, remoting, performance monitoring, tracing and logging, and framework internals. Rob noted that many organizations adopt Spring that aren’t aware of AOP. Subsequently it becomes validation, e.g., if a Spring consultant suggests using AOP, they can point out the customer has been using AOP in Spring for 6 months to assuage any fears.

The second part of the talk covered integration of AspectJ with Spring for more advanced uses. Adrian has blogged about this in past: both configuring AspectJ with Spring and extending Spring with fine-grained aspects in AspectJ. Adrian showed how to separate instantiation from configuration for non-singleton aspects. This used an aspect that has Spring configure a bean after instantiation, using an @Bean annotation. This is useful for beans too, that need context-sensitive instantiation (e.g., setting sessions on DAOs).

The next release of Spring will include an <aspect> xml tag (like <bean>) to make them easy to wire up. And there is significant collaboration to integrate Spring and AspectJ.

Advertisements