Announcement Announcement Module
Collapse
No announcement yet.
AOP, annotation-based pointcut and overriden methods Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.

    Comment

    Working...
    X