Which of the following annotations is specialized over the @Component annotation to indicate that a class is a web controller?
- @Service
- @Controller
- @Repository
- @Configuration
The @Controller annotation in Spring is specialized for indicating that a class is a web controller. While @Component is a generic stereotype annotation, @Controller is specifically meant for web request handling. It is used to identify controller classes that handle HTTP requests and define the entry points for web applications. The other options have different purposes; @Service is for service classes, @Repository for data access objects, and @Configuration for configuration classes.
Loading...
Related Quiz
- In Spring Security, to apply method security, one needs to enable it using the _____ annotation on a configuration class.
- In Spring Boot, which annotation is used to bind the properties defined in the application properties file to a POJO?
- Which of the following annotations is used to mark a class as a source of bean definitions?
- Which of the following is not a benefit of connection pooling in Spring Boot applications?
- In a Spring Boot application, the _____ annotation allows the conditional caching of method return values based on the evaluation of a SpEL expression.