我的SpringBoot应用程序提供了以下REST控制器: @RestControllerpublic class VerificationControllerverificationService.validateFormat(s1, s2); throw new ResponseStatusException(HttpS
我同时使用ExceptionAdvice和ResponseStatusException来处理web应用程序中的异常情况。现在,我想在我的控制器类中抛出ResponseStatusException时记录异常信息。我总是可以在我的Controller类中抛出异常的行附近编写日志代码: logger.error("some t
Spring 5引入了ResponseStatusException,直接从服务层抛出这个异常是一个很好的实践吗?User user = userRepository.findByUsernName(username); throw new ResponseStatusException(HttpStatus.NOT_FOUND, "user not found"); }案例2:还是