Announcement Announcement Module
Collapse
No announcement yet.
Applying an aspect to all classes inheriting interface/class Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Applying an aspect to all classes inheriting interface/class

    Hi,

    I have created an aspect as follows

    @Aspect
    public class ServiceAspect//implements MethodInterceptor
    {
    @Around("target(some.package.name.SomeInterface)")
    public Object invoke(ProceedingJoinPoint _pjp) throws Throwable
    {
    }
    }

    My intension is that this aspect should be called when ever any method is invoked on a bean that implements this interface. Is what I am doing correct. If not can you please suggest the changes.

    Also is it possible to do the same thing for a class instead of an interface, i.e. the aspect should be called for methods invoked on a class that extending a given class. Please let me know.

    Thanks,
    Rakesh.
Working...
X