Wrapping Method
Inside an aspect:
@Aspect
public class ServiceLogger
Before
@Before(value = "execution(* com.bernardomg..*Service*.*(..))",
argNames = "joinPoint")
public void beforeCall(final JoinPoint joinPoint) {
LOGGER.debug("Calling {} with arguments {}",
joinPoint.getSignature().toShortString(), joinPoint.getArgs());
}
After
@AfterReturning(
value = "execution(* com.bernardomg..*Service*.*(..))",
returning = "returnValue")
public void afterCall(final JoinPoint joinPoint, final Object returnValue) {
LOGGER.debug("Called {} and returning {}",
joinPoint.getSignature().toShortString(), returnValue);
}
Last updated
Was this helpful?