Last active
January 3, 2021 04:36
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//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