2V0-72.22PSE · Question #82
Which two statements about Spring MVC are true? (Choose two.)
The correct answer is C. Classes annotated with @Controller annotation can be detected by component scanning and D. Spring MVC requires a Servlet container, Spring Boot can embed Tomcat, Jetty or Undertow. C is correct because @Controller-annotated classes are Spring-managed beans, making them eligible for classpath component scanning - exactly like @Service or @Repository. This is a core Spring IoC feature. D is correct because Spring MVC is built on the Java Servlet API and…
Question
Which two statements about Spring MVC are true? (Choose two.)
Options
- AIt is an MVC framework that implements the JAX-RS specification,
- Bmvc.properties is used to provide URL mappings to controllers.
- CClasses annotated with @Controller annotation can be detected by component scanning and
- DSpring MVC requires a Servlet container, Spring Boot can embed Tomcat, Jetty or Undertow.
- EA DispatcherServlet is created for every @Controller/@RestController annotated class.
How the community answered
(33 responses)- A3% (1)
- C94% (31)
- E3% (1)
Explanation
C is correct because @Controller-annotated classes are Spring-managed beans, making them eligible for classpath component scanning - exactly like @Service or @Repository. This is a core Spring IoC feature.
D is correct because Spring MVC is built on the Java Servlet API and therefore requires a Servlet container to run. Spring Boot simplifies deployment by embedding Tomcat (default), Jetty, or Undertow directly in the JAR, eliminating the need for an external server.
Why the distractors are wrong:
- A - Spring MVC implements the Servlet specification, not JAX-RS. JAX-RS (e.g., Jersey, RESTEasy) is a separate specification for RESTful services.
- B - URL mappings are defined via
@RequestMapping(or@GetMapping, etc.) annotations on controllers, not amvc.propertiesfile. That file doesn't exist as a standard Spring construct. - E - There is only one
DispatcherServlet(the "Front Controller") for the entire application. It routes all requests to the appropriate controller method - having one per controller would defeat its purpose.
Memory tip: Think "D-ispatcherServlet = one, D-eployment needs a container" - the two D-facts about Spring MVC's architecture anchor option D, while C is simply "controllers are Spring beans, beans get scanned."
Topics
Community Discussion
No community discussion yet for this question.