spring
Archived Posts from this Category
Archived Posts from this Category
The spring framework provides an easy way for intercepting calls to methods of managed beans. In the project I am currently working at, we wanted to log access to all methods of the Connections returned by a specific datasource. This datasource is defined as a spring bean, but the connections it provides obviously aren’t.
In order to get this done, I decided intercept all calls to the getConnection() method of that specific DataSource an in stead of returning the Connection, I return a dynamic proxy to that connection which will log some method information prior to invoking that method.
Here is the source code and xml config I used to do this…
Continue Reading »
2 comments Thursday 03 May 2007 | Guy Mahieu | aop(t) , java(t) , spring(t)