Learn. Practice. Feel prepared.
Spring Boot Objective Questions and Answers - Set 4
Test your Spring Boot skills with carefully curated MCQs designed for real-world development and interview preparation. Focused on configuration, REST APIs, data access, security, and production-ready applications. This is part 4 of the series.
Practice Spring Boot MCQs with Detailed Explanations
Answer at least 12 questions to submit and verify answers.
46 Which annotation caches a method result? Medium
Correct answer:
@Cacheable
@Cacheable stores method results in cache for subsequent calls.
47 Which tool is commonly used for database migration in Spring Boot? Medium
Correct answer:
Liquibase
Liquibase manages database schema migrations.
48 Which annotation is used to inject a value from properties? Easy
Correct answer:
@Value
@Value injects values from configuration properties.
49 Which annotation enables Feign clients? Hard
Correct answer:
@EnableFeignClients
@EnableFeignClients activates Feign client scanning.
50 What does @FeignClient define? Hard
Correct answer:
REST client interface
@FeignClient defines a declarative REST client.
51 Which annotation enables circuit breaker support? Hard
Correct answer:
@EnableCircuitBreaker
Circuit breaker support helps build resilient microservices.
52 Which dependency enables OAuth2 support? Hard
Correct answer:
spring-boot-starter-oauth2-client
OAuth2 client support is enabled using the OAuth2 starter.
53 Which annotation makes a REST endpoint non-blocking? Hard
Correct answer:
@Async
@Async allows asynchronous, non-blocking method execution.
54 What is the main use of WebClient? Hard
Correct answer:
Reactive HTTP calls
WebClient is a non-blocking, reactive HTTP client.
55 Which annotation is used to validate request bodies? Medium
Correct answer:
@Validated
@Validated enables validation on request payloads.
56 What is the purpose of @CrossOrigin? Medium
Correct answer:
Enable CORS
@CrossOrigin enables Cross-Origin Resource Sharing.
57 Which annotation is used to mark a configuration class? Easy
Correct answer:
@Configuration
@Configuration marks a class as a source of bean definitions.
58 What is the default session management strategy in Spring Security? Hard
Correct answer:
IF_REQUIRED
Spring Security creates a session only when required.
59 Which annotation enables method-level security? Hard
Correct answer:
@EnableGlobalMethodSecurity
Method-level security allows access control on individual methods.
60 Which annotation marks a repository interface? Easy
Correct answer:
@Repository
@Repository marks data access layer components.