Skip to content

Instantly share code, notes, and snippets.

@rfum
Created September 21, 2017 14:35
Show Gist options
  • Save rfum/d9ba99ae0a4383103779bcaa66376847 to your computer and use it in GitHub Desktop.
Save rfum/d9ba99ae0a4383103779bcaa66376847 to your computer and use it in GitHub Desktop.
Logging.java
package aspect;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
@Aspect
public class Logging
{
@Around("SystemArchitecture.allSetterPointcut()")
public void setterAroundAdvice( ProceedingJoinPoint joinPoint)
{
try {
System.out.println("Target çalışmadan önce");
joinPoint.proceed();
System.out.println(joinPoint.toString());
System.out.println("Target çalıştıktan sonra");
} catch (Throwable throwable) {
throwable.printStackTrace();
}
}
@After("SystemArchitecture.oneArgOnly(name)")
public void singleArgAdvice (String name)
{
System.out.println(name);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment