From the course: Complete Guide to Spring MVC
Unlock this course with a free trial
Join today to access over 24,600 courses taught by industry experts.
Exceptions: Method arguments - Spring Tutorial
From the course: Complete Guide to Spring MVC
Exceptions: Method arguments
- Exceptions: method arguments. What are method arguments in exception handler annotation? When an exception is thrown in a Spring MVC application and @ExceptionHandler method can handle it, as we've seen before, and these methods can take various arguments to provide useful information about the exception, the request, or the user's context. The required argument would be exception. This is the most basic argument. It gives you the actual exception object, which contains details like error message, and stack trace. There are additional optional arguments that you could use that we've seen in our examples before. These give additional information about the context of the request or exception. So as we've seen with the HandlerMethod, this is details about the controller method that caused the exception. With ServletRequests, this is where you'll access the low-level servlet API for the request or response. With Locale, this is the user's locale, for language or region specific error…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Declaration overview4m 32s
-
(Locked)
Declaration: AOP proxies6m 23s
-
(Locked)
Mapping requests overview5m 19s
-
Mapping requests: URI patterns5m 50s
-
(Locked)
Mapping requests: Consumable media types4m
-
(Locked)
Mapping requests: Producible media types3m 53s
-
(Locked)
Handler methods overview3m 9s
-
(Locked)
Handler methods: Method arguments2m 54s
-
(Locked)
Handler methods: Return values5m 2s
-
(Locked)
Handler methods: Type conversion4m 47s
-
(Locked)
Model3m 16s
-
(Locked)
@InitBinder overview7m 46s
-
(Locked)
Validation3m 33s
-
(Locked)
Exceptions overview4m 39s
-
(Locked)
Exceptions: Method arguments3m 56s
-
(Locked)
Exceptions: Return values6m 47s
-
(Locked)
Controller advice10m 32s
-
(Locked)
-
-
-
-
-
-
-
-
-
-
-