Question 1 of 30
In a Spring MVC application, you are tasked with configuring the `DispatcherServlet` to handle multiple types of requests efficiently. You need to ensure that the servlet can route requests to different controllers based on the URL patterns and also handle exceptions gracefully. Given the following configuration snippets, which approach best illustrates the correct setup for the `DispatcherServlet` to achieve this functionality?
Configuring the `DispatcherServlet` in the `web.xml` file with multiple URL mappings and defining a global exception handler using `@ControllerAdvice`.
Using a single URL mapping for the `DispatcherServlet` and relying solely on the `@ExceptionHandler` annotation within each controller to manage exceptions.
Defining multiple `DispatcherServlet` instances in the `web.xml` file, each with its own URL mapping, but without a centralized exception handling mechanism.
Configuring the `DispatcherServlet` to handle all requests through a single controller that delegates to other services, without any exception handling.

Preparing for VMWare 2V0-72.22 Professional Develop VMware Spring? Now land the interview.

73% of qualified candidates get rejected because of weak resumes. Build an ATS-optimized, recruiter-ready resume in under 5 minutes - free to start.

Build My Resume Free