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.
Loading...
Related Quiz
- For unit testing repositories in Spring Boot, the _____ annotation is used to disable full auto-configuration and instead apply only configuration relevant to JPA tests.
- What is the significance of the client-side load balancer, Ribbon, in a Spring Cloud environment?
- How can you implement Token Enhancement to include additional information in the OAuth2 access token?
- How can you ensure that the ApplicationContext is not loaded while performing unit testing on web layers in Spring Boot?
- In a Spring Boot application, how would you secure microservices using OAuth2 and JWT?