REST Flashcards

1
Q

Which dependency is essential for building RESTful web services in Spring Boot?

A

spring-boot-starter-web

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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

A

It indicates that the class is a controller where every method returns a domain object instead of a view.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the default behavior of Spring Boot when an error occurs in a RESTful service?

A

It returns a “Whitelabel Error Page”.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How can you customize the error handling in Spring Boot to return a specific HTTP status code and message?

A

By using the @ExceptionHandler annotation.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Which authentication mechanism should be used to securely transmit information between a client and server as a JSON object?

A

JWT (JSON Web Token)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What does the Basic Authentication scheme involve?

A

Sending the username and password encoded in the HTTP Authorization header.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Which dependency is essential for testing Spring Boot applications?

A

spring-boot-starter-test

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

What is the purpose of the @SpringBootTest annotation in a Spring Boot test?

A

It loads the complete application context for integration testing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly