REST Flashcards
Which dependency is essential for building RESTful web services in Spring Boot?
spring-boot-starter-web
What is the primary role of the @RestController annotation in a Spring Boot application?
It indicates that the class is a controller where every method returns a domain object instead of a view.
What is the default behavior of Spring Boot when an error occurs in a RESTful service?
It returns a “Whitelabel Error Page”.
How can you customize the error handling in Spring Boot to return a specific HTTP status code and message?
By using the @ExceptionHandler annotation.
Which authentication mechanism should be used to securely transmit information between a client and server as a JSON object?
JWT (JSON Web Token)
What does the Basic Authentication scheme involve?
Sending the username and password encoded in the HTTP Authorization header.
Which dependency is essential for testing Spring Boot applications?
spring-boot-starter-test
What is the purpose of the @SpringBootTest annotation in a Spring Boot test?
It loads the complete application context for integration testing.