exception : spring - DefaultHandlerExceptionResolver

This commit is contained in:
haerong22
2021-07-26 18:42:18 +09:00
parent 2706e2f16d
commit 0e7cd9f28e

View File

@@ -8,6 +8,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.server.ResponseStatusException;
@@ -40,6 +41,11 @@ public class ApiExceptionController {
public String responseStatusEx2() {
throw new ResponseStatusException(HttpStatus.NOT_FOUND, "error.bad", new IllegalArgumentException());
}
@GetMapping("/api/default-handler-ex")
public String defaultException(@RequestParam Integer data) {
return "ok";
}
@Data
@AllArgsConstructor