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.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *