1

Developing in Spring Boot 2.2 and using Spring MVC REST endpoint, when errors occur, I'm sending a static object from ControllerAdvice, e.g.

@RestControllerAdvice
public class MyExceptionHandler {

  private static final MyObj ERROR_OBJ = new MyObj();

  @ExceptionHandler(MyException.class)
  public ResponseEntity<Object> handlerMyException(MyException ex) {
     // Some logging
     return new ResponseEntity(ERROR_OBJ, /* some HTTP status */);
  }
}

With this approach, since the response in such scenario is always the same, does it create performance issue/deadlock when multiple requests have to send the same object back (in this case, ERROR_OBJ)?

NuCradle
  • 665
  • 1
  • 9
  • 31

0 Answers0