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

Which two statements are true about @Controller annotated classes? (Choose two.)
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.

Answer: BE

Explanation:

B. The classes are eligible for handling requests in Spring MVC.

This is true because the @Controller annotation marks a class as a web request handler, and it is typically used with the @RequestMapping annotation to map specific URLs to methods1. The @Controller annotation also allows the class to be recognized as a Spring-managed component through the classpath scanning2.

E. The @Controller annotation is a stereotype annotation like @Component.

This is true because the @Controller annotation is a specialization of the generic stereotype @Component annotation, which allows a class to be recognized as a Spring-managed component3. The @Controller annotation extends the use-case of @Component and marks the annotated class as a business or presentation layer4.

Reference:

https://www.baeldung.com/spring-mvc-handler-adapters https://www.dineshonjava.com/stereotype-annotations-in-spring/

Latest 2V0-72.22 Dumps Valid Version with 60 Q&As

Latest And Valid Q&A | Instant Download | Once Fail, Full Refund

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments