2v0-7222 Exam QuestionsBrowse all questions from this exam

2v0-7222 Exam - Question 28


Which two statements are true about @Controller annotated classes? (Choose two.)

Show Answer
Correct Answer: BE

The @Controller annotated classes are eligible for handling requests in Spring MVC. This annotation indicates that a particular class serves the role of a controller in an MVC pattern, receiving web requests and returning a view or data. Additionally, @Controller is considered a stereotype annotation, similar to @Component, meaning it marks the class as a Spring-managed component. This allows for automatic detection through component scanning mechanisms. The other options contain inaccuracies: @Controller annotated classes can do more than just render views, they do not need to be paired with @EnableMvcMappings to be discovered via component scanning, and @Controller is not interchangeable with @RestController without extra considerations because @RestController combines @Controller and @ResponseBody.

Discussion

1 comment
Sign in to comment
saJAvaOptions: BE
Jun 10, 2024

correct