Skip to content

Instantly share code, notes, and snippets.

@skaveesh
Last active January 3, 2021 04:36
Show Gist options
  • Save skaveesh/e54925cbf54014ee9d9135ca5af748cc to your computer and use it in GitHub Desktop.
Save skaveesh/e54925cbf54014ee9d9135ca5af748cc 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
@RestController("/")
public class Controller {
//code is omitted for brevity
@GetMapping(value = "calltest", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> callTest(){
return new ResponseEntity<>(downstreamService.callTest(), HttpStatus.OK);
}
@GetMapping(value = "calltestslow", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> callTestSlow(){
return new ResponseEntity<>(downstreamService.callTestSlow(), HttpStatus.OK);
}
@GetMapping(value = "calltesterror", produces = MediaType.APPLICATION_JSON_VALUE)
public ResponseEntity<Object> callTestError(){
return new ResponseEntity<>(downstreamService.callTestError(), HttpStatus.OK);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment