Results 1 to 2 of 2

Thread: AOP, annotation-based pointcut and overriden methods

  1. #1

    Default AOP, annotation-based pointcut and overriden methods

    Hi,

    I have a aspect which declares an annotation based pointcut :
    Code:
    "@annotation(my.package.MyAnnotation)"
    I have a spring bean which is abstract and parametrized :
    Code:
    public abstract class MyAbstractBeanBOImpl<T extends MyGenericType> extends
    		AbstractBOImpl<T> implements MyAbstractBeanBO {
    This bean declares an "update" method :
    Code:
    public T update(T entity) {
    I have an typed spring bean which extends MyAbstractBeanBOImpl, and overrides the update method :
    Code:
    @MyAnnotation("XXX")
             @Override
    	public MyTypedType update(MyTypedType entity) {
    My beans are configured to expose proxies and to proxy target classes with CGLIB.

    AOP does not trigger when I call the "update" method from ImageBOImpl.
    AOP does trigger if I annotate the "update" method from MyAbstractBeanBOImpl with @MyAnnotation.

    This is a issue to me as I want to pass a particular value to my annotation in the child class.

    Is this normal behavior ? Why does AOP rely on the parent method signature ?

    I took a look at Spring Security because I noticed that this does not behave like this. In that case, an interceptor registers all eligible methods and save the @Secured annotation attribute in a cache, which is read when the aspect is called. I wish I had not to create such mechanism...

    Any hint ?

  2. #2

    Default

    ok I have something new about this issue.

    Aspect is triggered when @MyAnnotation is both on the abstract and child bean, but it will always take the value from the abstract.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •