Skip to content

Instantly share code, notes, and snippets.

@skaveesh
Last active January 3, 2021 04:36
Show Gist options
  • Save skaveesh/0c11fdaa9265b3b4e6cac7c5dc7ff9c8 to your computer and use it in GitHub Desktop.
Save skaveesh/0c11fdaa9265b3b4e6cac7c5dc7ff9c8 to your computer and use it in GitHub Desktop.
How I Decoupled Circuit Breaker from the Code with AOP in Spring Boot for Better Code Maintenance
//code is omitted for brevity
@Aspect
@Component
public class CircuitBreakerAOPConfig {
@Around("@annotation(com.skaveesh.dcb.annotation.EnableCircuitBreakerScan)")
public Object around(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
Object[] args = proceedingJoinPoint.getArgs();
Object returnValue = proceedingJoinPoint.proceed(args);
//logging what happened above, if like
return returnValue;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment