framework

May 13 2011

Proxies and Aspects in Spring

In my latest project I had a requirement to log the inputs and outputs generated by a method with the same name across multiple objects. This was a little more complicated than the functionality included in the SimpleTraceInterceptor and the DebugInterceptor provided by Spring (http://java.dzone.com/articles/using-spring-aop-trace ) since some processing was involved.

Instead of directly modifying every single one of my classes I decided to take advantage of the support for Aspects that Spring has. There are several sites that describe how to configure an aspect using Spring, including the Spring documentation (http://static.springsource.org/spring/docs/2.5.0/reference/aop.html ). After following those instructions I end up with the following:

Read More

 

Disclaimer

The words and opinions expressed here are those of each article's respective author, and do not necessarily represent the views of CapTech Ventures.