VMware vRealize Automation 8.x (2022) — Question 54
Which two statements are true about @Controller annotated classes? (Choose two.)
Answer options
- A. The @Controller annotated classes can only render views.
- B. The classes are eligible for handling requests in Spring MVC.
- C. The classes must be annotated together with @EnableMvcMappings to be discovered via component scanning.
- D. @Controller is interchangeable with @RestController with no extra code changes for the methods inside the class.
- E. The @Controller annotation is a stereotype annotation like @Component.
Correct answer: B, E
Explanation
The correct statements are B and E. Statement B is accurate because classes annotated with @Controller are designed to handle web requests in Spring MVC. Statement E is also correct as @Controller is indeed a stereotype annotation, similar to @Component. Statements A, C, and D are incorrect because @Controller classes can do more than just render views, do not require @EnableMvcMappings for discovery, and are not interchangeable with @RestController without changes in method behavior.