2 Attachment(s)
AOP not working on DAO interface
Hi all,
i'm setting up a web server with Spring 3.0.5, and i'm having issues trying to declare an aspect on a DAO interface.
My DAO object hierarchy (described in attached picture Attachment 4477) defines a template DAO base interface IBaseDAO<T>, implemented by a template DAO base abstract class: BaseDao<T> which implements a base version of all the IBaseDAO methods, including saveOrUpdate(T) amongst others.
For each business object class, i create a specialization of the IBaseDAO<T>, and i create a DAO class that both implements that specialized interface and extends the base abstract DAO class BaseDAO<T>.
For instance, for the Comment BO, i define the CommentDAO class (no method redefinition), that implements ICommentDAO (this interface has no method) and extends IBaseDAO<T>.
I'd like to create an aspect that triggers when the method saveOrUpdate() is called on class CommentDAO. For that i define the following aspect:
Code:
<aop:config>
<aop:aspect ref="systemPropController">
<aop:before
pointcut="execution(* fr.magellium.training.model.dao.iface.ICommentDAO.saveOrUpdate(..))"
method="updateLastModifDate" />
</aop:aspect>
</aop:config>
This aspect never triggers. The only workaround I found is to declare an aspect on every call to saveOrUpdate(), whatever the class:
Code:
<aop:config>
<aop:aspect ref="systemPropController">
<aop:before
pointcut="execution(* saveOrUpdate(..))"
method="updateLastModifDate" />
</aop:aspect>
</aop:config>
It seems like Spring AOP doesn't recognize saveOrUpdate(..) as a method of the ICommentDAO interface.
I can't figure out what i'm missing here...