When configuring OAuth2 Resource Server in Spring Boot, the _____ property is used to specify the location of the public key for verifying JWT signatures.

  • public_key_location
  • jwt_signing_key
  • token_verifier
  • security_policy
When configuring an OAuth2 Resource Server in Spring Boot, the public_key_location property is used to specify the location of the public key for verifying JWT signatures. This key is essential for validating the authenticity and integrity of JWT tokens used for authentication and authorization. The other options are not typically used for specifying the public key location.

In Spring Boot, which annotation is used to denote that a test class should load only specific parts of the application context for Web tests?

  • @ContextConfiguration
  • @SpringBootTest
  • @WebAppConfiguration
  • @WebMvcTest
The @WebMvcTest annotation is used to load only the Web layer of the Spring application context, making it suitable for testing controllers and related components.

How can you conditionally exclude specific Auto Configurations in a Spring Boot application?

  • Using the spring.autoconfigure.exclude property in application.properties or application.yml.
  • By annotating the class with @ExcludeAutoConfiguration and specifying the classes to exclude.
  • By removing the Auto Configuration JARs from the classpath.
  • By using a custom excludeAutoConfiguration method in the main application class.
To conditionally exclude specific Auto Configurations, you can use the spring.autoconfigure.exclude property in your application.properties or application.yml file. This property allows you to specify the fully qualified names of the Auto Configuration classes you want to exclude. The other options do not provide a direct way to conditionally exclude Auto Configurations.

To perform integration testing in Spring Boot, the _____ annotation is used to enable full application context loading.

  • @ContextConfiguration
  • @IntegrationTest
  • @RunWith(SpringRunner.class)
  • @SpringBootTest
In Spring Boot, to perform integration testing and enable full application context loading, you use the @SpringBootTest annotation. This annotation loads the entire Spring application context, making it suitable for integration testing scenarios.

To customize the response body of a global exception handler method in Spring Boot, the method should return an object of type _____.

  • CustomResponse
  • ExceptionResponse
  • ResponseEntity
  • ResponseObject
To customize the response body of a global exception handler method in Spring Boot, the method should return an object of type ResponseEntity. This allows you to create a custom response with specific status codes, headers, and response bodies when an exception is caught globally. It provides flexibility in crafting error responses tailored to your application's needs.

Which annotation is used to disable full auto-configuration and instead apply only configuration relevant to JPA tests in Spring Boot?

  • @AutoConfigureTestDatabase
  • @JpaTest
  • @RunWith(SpringRunner.class)
  • @SpringBootTest
The @JpaTest annotation is used in Spring Boot to disable full auto-configuration and apply configuration relevant to JPA tests. It sets up an environment for testing JPA repositories. @SpringBootTest and @RunWith(SpringRunner.class) are more general-purpose testing annotations, while @AutoConfigureTestDatabase is used for configuring the test database.

What is the primary purpose of monitoring in a Spring Boot application?

  • Enforcing security policies
  • Generating test reports
  • Identifying critical issues
  • Optimizing database queries
The primary purpose of monitoring in a Spring Boot application is to identify critical issues. Monitoring helps you keep a close watch on the health and performance of your application in production. By continuously monitoring various metrics and endpoints provided by Spring Boot Actuator, you can quickly detect and respond to issues such as application failures, memory leaks, high CPU usage, and more. While other activities like enforcing security policies, optimizing database queries, and generating test reports are essential in software development, they are not the primary purpose of monitoring in a Spring Boot application.

Which Spring Boot property is used to define the URL of the database?

  • spring.datasource.url
  • spring.application.name
  • server.port
  • spring.main.web-application-type
In Spring Boot, the property spring.datasource.url is used to define the URL of the database. This property specifies the database connection URL, including the protocol, host, port, and database name. It is an essential configuration when connecting to a database in a Spring Boot application. The other options are unrelated to defining the database URL.

For optimizing the performance of RESTful APIs in Spring Boot, developers can enable _____ to compress the HTTP response.

  • CORS
  • GZIP
  • OAuth2
  • SSL
To optimize the performance of RESTful APIs in Spring Boot, developers can enable GZIP compression for the HTTP response. Enabling GZIP compression reduces the amount of data sent over the network by compressing the response before sending it to the client. This reduces the bandwidth usage and speeds up API response times, especially when dealing with large payloads. Enabling GZIP compression is a common technique for improving the performance of web applications, including RESTful APIs.

In a Spring Cloud environment, to configure a service to discover its peers using Eureka, the property ____ must be defined in the application's properties or YAML file.

  • eureka.application.instance-id
  • eureka.client.register-with-eureka
  • eureka.client.service-url
  • eureka.service.discovery
In a Spring Cloud environment, to configure a service to discover its peers using Eureka, the property eureka.client.register-with-eureka must be defined in the application's properties or YAML file. This property determines whether the service should register itself with the Eureka server. Setting it to true allows the service to register, and it will be discoverable by other services through Eureka.