This topic has not yet been written. The content below is from the topic description.
This advice does a check on the invocation parameter type so it can display the correct message and access methods that are specific to the joinpoint type being intercepted. This can be avoided by overloading aroundAdvice, so that we have a version for each Invocation type: public Object aroundAdvice(ConstructorInvocation invocation) throws Throwable { System.out.println(">>> aroundAdvice on constructor of class: " + invocation.getConstructor().getDeclaringClass().getName()); return invocation.invokeNext(); } public Object aroundAdvice(MethodInvocation invocation) throws Throwable { System.out.println(">>> aroundAdvice on method execution: " + invocation.getMethod().getName()); return invocation.invokeNext(); } public Object aroundAdvice(FieldReadInvocation invocation) throws Throwable { System.out.println(">>> aroundAdvice on field read: " + invocation.getField().getName()); return invocation.invokeNext(); } public Object aroundAdvice(FieldWriteInvocation invocation) throws Throwable { System.out.println(">>> aroundAdvice on field write: " + invocation.getField().getName()); return invocation.invokeNext(); }