Table of Contents
- Core Spring & Spring Boot Concepts
- Spring Boot Annotations & Configuration
- Dependency Injection & Bean Lifecycle
- Spring Boot Auto-Configuration & Starter Packs
- Spring Data JPA & Transactions
- Spring Boot REST APIs (Controllers, Validation, Exception Handling)
- Spring Security (OAuth2, JWT, Role-Based Access)
- Spring Boot with Microservices
- Spring Boot with Cloud & AWS
- Spring Boot Testing (JUnit5, Mockito, Integration Tests, Testcontainers)
- Spring Boot Actuator, Monitoring & Observability
- Conclusion
πΉ Core Spring & Spring Boot Concepts
- What is Spring Framework? How is it different from Spring Boot?
- Why was Spring Boot introduced? What problems does it solve?
- What are the advantages of using Spring Boot in enterprise applications?
- Explain the differences between Spring, Spring MVC, and Spring Boot.
- How does Spring Boot simplify dependency management?
- What is an embedded server in Spring Boot? Which servers are supported?
- Explain the concept of convention over configuration in Spring Boot.
- What are Spring Boot Starters? Give examples of commonly used ones.
- What are Spring Boot DevTools? Why are they used?
- How does Spring Boot differ from traditional WAR-based deployments?
- What is Spring Initializr and how does it help in project setup?
- What is the role of Spring Boot CLI? When is it useful?
- How does Spring Boot achieve auto-configuration?
- What are common Spring Boot application.properties and application.yml configurations?
- What is the difference between `application.properties` and `application.yml`?
- Explain Spring Bootβs layered architecture.
- What is the default logging framework used in Spring Boot?
- What are the limitations of Spring Boot?
- How do profiles work in Spring Boot?
- How do you override default properties in Spring Boot?
πΉ Spring Boot Annotations & Configuration
- What does the `@SpringBootApplication` annotation do internally?
- Difference between `@Component`, `@Service`, `@Repository`, and `@Controller`.
- Explain the use of `@Configuration` and `@Bean` annotations.
- What is the difference between `@ComponentScan` and `@EnableAutoConfiguration`?
- How does `@ConditionalOnProperty` work in Spring Boot?
- Explain the purpose of `@EnableConfigurationProperties` and `@ConfigurationProperties`.
- What is the difference between `@Value` and `@ConfigurationProperties`?
- How does Spring Boot handle externalized configuration?
- Explain `@Import` and when to use it.
- What does `@EnableScheduling` do? Provide an example.
- Difference between `@RestController` and `@Controller` in Spring Boot.
- What is the use of `@EnableAsync` in Spring Boot?
- Explain the `@Lazy` annotation in Spring.
- Difference between `@Primary` and `@Qualifier` annotations.
- What is the use of `@Profile` in Spring Boot?
- How does `@Scope` annotation work in Spring Boot?
- What is `@EnableTransactionManagement`?
- What is the role of `@PropertySource` annotation?
- What is the difference between `@ImportResource` and `@Import`?
- Explain `@EnableJpaRepositories` and its usage.
πΉ Dependency Injection & Bean Lifecycle
- What is Dependency Injection (DI) in Spring? Why is it important?
- What are the different types of Dependency Injection in Spring?
- What is the difference between constructor injection and setter injection?
- Which injection method is preferred in Spring and why?
- How does Spring manage the lifecycle of a bean?
- What is the role of the `BeanFactory` interface?
- Difference between `ApplicationContext` and `BeanFactory`.
- What are the different bean scopes available in Spring?
- How do you create a prototype-scoped bean?
- What is the default bean scope in Spring Boot?
- Explain the difference between singleton bean and prototype bean.
- What is the role of `@PostConstruct` and `@PreDestroy` annotations?
- How do you define custom initialization and destruction methods for beans?
- What are BeanPostProcessor and BeanFactoryPostProcessor?
- What is the difference between `@Autowired` and `@Inject`?
- What is circular dependency in Spring? How is it handled?
- Difference between field injection, setter injection, and constructor injection.
- What is `@DependsOn` annotation in Spring?
- How do you create lazy-initialized beans in Spring Boot?
- Explain the lifecycle phases of a Spring bean with example.
πΉ Spring Boot Auto-Configuration & Starter Packs
- What is auto-configuration in Spring Boot? How does it work?
- What is the role of `spring.factories` in auto-configuration?
- What is the difference between `@EnableAutoConfiguration` and `@SpringBootApplication`?
- How do you exclude an auto-configuration class in Spring Boot?
- What is the purpose of `META-INF/spring.factories` file?
- How do you create a custom auto-configuration in Spring Boot?
- What is the difference between `@ConditionalOnClass` and `@ConditionalOnMissingBean`?
- What is `@ConditionalOnProperty` and when would you use it?
- Explain `@ConditionalOnResource` and its use case.
- What are Spring Boot Starter dependencies?
- Give examples of commonly used Spring Boot Starter dependencies.
- How do Spring Boot Starters simplify dependency management?
- What is the difference between `spring-boot-starter-web` and `spring-boot-starter-webflux`?
- What is `spring-boot-starter-data-jpa` and what does it provide?
- Explain the role of `spring-boot-starter-security`.
- What is the purpose of `spring-boot-starter-test`?
- How do you create a custom Spring Boot Starter?
- What are the advantages of custom Spring Boot Starters?
- How do you debug issues with auto-configuration in Spring Boot?
- What is the role of `spring-boot-autoconfigure` module?
πΉ Spring Data JPA & Transactions
- What is Spring Data JPA and how is it different from Hibernate?
- What are the advantages of using Spring Data JPA?
- What is the role of `JpaRepository` interface?
- Difference between `CrudRepository`, `PagingAndSortingRepository`, and `JpaRepository`.
- How do you define custom query methods in Spring Data JPA?
- What is the difference between JPQL and native SQL queries?
- How do you use `@Query` annotation in Spring Data JPA?
- What is the difference between `getOne()` and `findById()`?
- Difference between `save()` and `saveAndFlush()`.
- What are derived query methods in Spring Data JPA?
- What is optimistic locking vs pessimistic locking in JPA?
- What is the role of `@Transactional` annotation in Spring Boot?
- Difference between declarative and programmatic transaction management.
- How do you configure transaction propagation in Spring?
- What is the difference between `REQUIRED`, `REQUIRES_NEW`, and `MANDATORY` propagation levels?
- What is the role of isolation levels in transactions?
- Explain `READ_COMMITTED`, `REPEATABLE_READ`, and `SERIALIZABLE` isolation levels.
- What is dirty read, non-repeatable read, and phantom read?
- How do you roll back transactions in Spring Boot?
- What is the difference between `rollbackFor` and `noRollbackFor` in `@Transactional`?
πΉ Spring Boot REST APIs (Controllers, Validation, Exception Handling)
- How do you create a REST API in Spring Boot?
- Difference between `@Controller` and `@RestController`.
- What is the role of `@RequestMapping` annotation?
- Difference between `@GetMapping`, `@PostMapping`, `@PutMapping`, `@DeleteMapping`, and `@PatchMapping`.
- How do you pass path variables in Spring Boot REST APIs?
- What is the difference between `@RequestParam` and `@PathVariable`?
- How do you send and receive JSON in Spring Boot?
- What is the role of `@RequestBody` annotation?
- What is the role of `@ResponseEntity`?
- How do you implement global exception handling in Spring Boot?
- What is the use of `@ControllerAdvice`?
- What is the difference between `@ExceptionHandler` and `@ControllerAdvice`?
- How do you perform input validation in Spring Boot?
- What is the role of `@Valid` and `@Validated` annotations?
- How do you define custom validation constraints?
- What is the difference between checked and unchecked exceptions in REST APIs?
- How do you implement versioning in REST APIs (URI, Query Params, Headers)?
- How do you implement HATEOAS in Spring Boot?
- How do you implement pagination and sorting in REST APIs?
- How do you secure REST APIs in Spring Boot?
πΉ Spring Security (OAuth2, JWT, Role-Based Access)
- What is Spring Security and why is it used?
- Difference between authentication and authorization.
- How do you configure basic authentication in Spring Boot?
- What is the role of `UserDetailsService` in Spring Security?
- What is the difference between `GrantedAuthority` and `Role`?
- How do you secure REST APIs with role-based access in Spring Boot?
- What is CSRF protection? How does Spring Security handle it?
- What is JWT (JSON Web Token)? How is it used in Spring Security?
- What are the advantages of JWT over session-based authentication?
- How do you implement JWT authentication in Spring Boot?
- What is the role of filters in Spring Security?
- Difference between `OncePerRequestFilter` and `GenericFilterBean`.
- What is OAuth2 and how does it work with Spring Security?
- Difference between OAuth2 authorization code flow, implicit flow, and client credentials flow.
- How do you implement OAuth2 login in Spring Boot?
- What is the difference between `@EnableWebSecurity` and `WebSecurityConfigurerAdapter`?
- How do you customize Spring Security configuration in Spring Boot 3.x (no `WebSecurityConfigurerAdapter`)?
- What is stateless authentication and why is it important for REST APIs?
- How do you secure endpoints with method-level security (`@PreAuthorize`, `@Secured`)?
- What is the difference between symmetric and asymmetric encryption in JWT?
πΉ Spring Boot with Microservices
- What are microservices and how are they different from monoliths?
- What are the main advantages of using microservices architecture?
- How do you implement service discovery using Eureka?
- What is the role of Netflix Eureka in Spring Cloud?
- How do you configure a Spring Boot application as a Eureka client?
- What is Spring Cloud Config Server? How is it used?
- How do you secure communication between Config Server and microservices?
- What is API Gateway? Difference between Zuul and Spring Cloud Gateway.
- How do you implement request routing with Spring Cloud Gateway?
- What is Feign Client and why is it used in microservices?
- Difference between Feign Client and RestTemplate.
- What is load balancing in microservices? How does Ribbon work?
- What is Resilience4j and how does it improve fault tolerance?
- Difference between Circuit Breaker, Bulkhead, Retry, and Rate Limiter patterns.
- How do you implement a circuit breaker in Spring Boot with Resilience4j?
- What is Hystrix? Why is Resilience4j preferred over Hystrix?
- What is distributed tracing? How do you implement it in Spring Boot?
- What are Sleuth and Zipkin? How do they work with Spring Boot?
- How do you handle centralized logging in microservices?
- What are the best practices for designing Spring Boot microservices?
πΉ Spring Boot with Cloud & AWS
- How do you deploy a Spring Boot application to AWS?
- What is the difference between AWS Elastic Beanstalk and ECS for Spring Boot apps?
- How do you connect a Spring Boot application to AWS RDS?
- What are the best practices for securing AWS RDS credentials in Spring Boot?
- How do you use AWS Parameter Store or Secrets Manager with Spring Boot?
- How do you integrate Spring Boot with AWS S3?
- How do you upload and download files to S3 using Spring Boot?
- What is the difference between S3 and EFS? When to use each?
- How do you integrate Spring Boot with AWS SQS?
- Difference between SQS standard and FIFO queues.
- How do you integrate Spring Boot with AWS SNS?
- What is the difference between SQS and SNS?
- How do you integrate Spring Boot with AWS Lambda?
- What are the best practices for building serverless applications with Spring Boot on AWS?
- How do you implement distributed caching with AWS ElastiCache (Redis/Memcached)?
- How do you configure Spring Boot for AWS DynamoDB?
- Difference between RDS and DynamoDB for Spring Boot apps.
- How do you secure Spring Boot applications running on AWS (IAM roles, VPCs, security groups)?
- What is AWS API Gateway and how do you integrate it with Spring Boot microservices?
- How do you monitor and scale Spring Boot microservices on AWS?
πΉ Spring Boot Testing (JUnit5, Mockito, Integration Tests, Testcontainers)
- What are the different types of testing in Spring Boot?
- Difference between unit test and integration test.
- How do you write a simple JUnit 5 test in Spring Boot?
- How do you mock dependencies using Mockito?
- Difference between `@Mock` and `@MockBean` in Spring Boot tests.
- What is the role of `@SpringBootTest` annotation?
- What is `@DataJpaTest` used for?
- How do you test REST controllers in Spring Boot?
- What is `MockMvc` and how is it used?
- Difference between `WebMvcTest` and `SpringBootTest`.
- How do you test service layer components?
- How do you test exception handling in Spring Boot?
- What are Testcontainers? Why are they useful?
- How do you use Testcontainers with Spring Boot?
- How do you test with an in-memory database like H2?
- What is the role of embedded Kafka/RabbitMQ in integration tests?
- How do you measure code coverage in Spring Boot tests?
- How do you test asynchronous methods in Spring Boot?
- How do you run Spring Boot tests in parallel?
- What are best practices for writing maintainable Spring Boot tests?
πΉ Spring Boot Actuator, Monitoring & Observability
- What is Spring Boot Actuator and why is it used?
- What are the default Actuator endpoints available in Spring Boot?
- How do you enable and secure Actuator endpoints?
- How do you create custom Actuator endpoints?
- What is Micrometer in Spring Boot?
- How do you integrate Spring Boot with Prometheus?
- How do you integrate Spring Boot with Grafana dashboards?
- How do you configure distributed tracing with Spring Cloud Sleuth?
- What is Zipkin and how does it integrate with Spring Boot?
- How do you send Spring Boot logs to ELK stack (Elasticsearch, Logstash, Kibana)?
- What are the best practices for monitoring microservices in production?
- What is health check endpoint and why is it important in cloud deployments?
- How do you configure metrics for JVM memory, threads, and garbage collection?
- How do you enable request/response tracing in Spring Boot?
- How do you integrate Spring Boot with centralized logging frameworks?
- What is OpenTelemetry and how does it relate to Spring Boot observability?
- How do you configure graceful shutdown in Spring Boot applications?
- What are performance tuning tips for Spring Boot in production?
- How do you handle thread pool tuning in Spring Boot?
- What are the common production pitfalls in Spring Boot and how to avoid them?
π Conclusion
π₯ This compilation serves as a professional, structured, and comprehensive 200+ question Spring Boot interview preparation guide, ensuring complete coverage of critical areas:
βοΈ Core Spring & Spring Boot Concepts
βοΈ Annotations, Configuration & Bean Lifecycle
βοΈ Auto-Configuration & Starter Packs
βοΈ Spring Data JPA & Transaction Management
βοΈ REST API Development, Validation & Exception Handling
βοΈ Spring Security (OAuth2, JWT, Role-Based Access)
βοΈ Microservices with Spring Cloud (Eureka, Feign, API Gateway, Config Server, Resilience4j)
βοΈ Cloud & AWS Integrations (S3, SQS, SNS, RDS, Lambda)
βοΈ Spring Boot Testing (JUnit5, Mockito, Integration, Testcontainers)
βοΈ Monitoring & Observability (Actuator, Micrometer, Prometheus, Grafana, ELK)
βοΈ Performance Tuning, Best Practices & Advanced Scenarios
This guide is designed as a master reference for Spring Boot interviews across startups, product-based firms, and enterprise companies.
By practicing these questions, coding exercises, and real-world case studies,
you will be fully prepared to tackle both conceptual and applied challenges in modern backend engineering interviews with confidence.