What is the purpose of the @RestController annotation in a Spring Boot application?

  • To define a RESTful web service endpoint.
  • To configure the application's data source.
  • To handle database transactions.
  • To create a user interface.
The @RestController annotation is used in Spring Boot to define a RESTful web service endpoint. It indicates that the class is a controller responsible for handling HTTP requests and returning responses in a RESTful manner. This annotation is essential for building REST APIs in Spring Boot. The other options do not accurately describe the purpose of this annotation.
Add your answer
Loading...

Leave a comment

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