These questions test foundational conceptual mastery, syntax accuracy, and core theoretical knowledge:
Q1. What is Spring Boot and how does it differ from traditional Spring Framework?
Foundation • 0-2 Yrs
Traditional Spring requires extensive manual XML or Java configuration, explicit dependency management, and external web server deployment (e.g., Apache Tomcat). Spring Boot provides opinionated convention-over-configuration: starter dependencies, automated bean configuration (Auto-Configuration), embedded servlet containers (Tomcat, Jetty), and production metrics via Actuator.
Q2. What is Inversion of Control (IoC) and Dependency Injection (DI)?
Foundation • 0-2 Yrs
IoC is a software design principle where control of object creation and lifecycle management is transferred from the application code to a framework container (Spring IoC Container). Dependency Injection is the pattern used to implement IoC: dependencies are passed (injected) into dependent objects at runtime.
Q3. Explain the difference between Constructor Injection, Setter Injection, and Field Injection.
Foundation • 0-2 Yrs
Constructor Injection: Dependencies are passed via constructor (recommended; guarantees immutability, facilitates unit testing, and prevents NPEs). Setter Injection: Dependencies are set via setter methods (good for optional dependencies). Field Injection: Uses @Autowired directly on private fields (discouraged; hides dependencies and makes testing difficult).
Q4. What are Spring Boot Starters and what is their benefit?
Foundation • 0-2 Yrs
Spring Boot Starters are pre-packaged sets of convenient dependency descriptors (e.g., spring-boot-starter-web, spring-boot-starter-data-jpa). They bundle compatible library versions, eliminating version conflicts and reducing build file configurations.
Q5. Explain the @SpringBootApplication annotation and what it encapsulates.
Foundation • 0-2 Yrs
@SpringBootApplication is a meta-annotation that encapsulates three critical annotations: @Configuration (declares class as bean source), @EnableAutoConfiguration (enables automatic bean creation based on classpath), and @ComponentScan (enables package scanning for @Component, @Service, @Repository).
Q6. What are Spring Bean Scopes and what is the default scope?
Foundation • 0-2 Yrs
Singleton: Exactly one bean instance per Spring IoC container (default). Prototype: New bean instance created every time requested. Web-aware scopes: Request (one per HTTP request), Session (one per HTTP session), Application (one per ServletContext), and WebSocket.
Q7. What is Spring Boot Actuator and what endpoints are most useful?
Foundation • 0-2 Yrs
Spring Boot Actuator provides production-ready monitoring and management endpoints. Key endpoints: /actuator/health (verifies service and DB status), /actuator/metrics (CPU, memory, JVM stats), /actuator/info, /actuator/beans, and /actuator/env.
Q8. Explain the difference between @RestController and @Controller in Spring.
Foundation • 0-2 Yrs
@Controller is used for traditional MVC web applications returning HTML view names resolved by a ViewResolver. @RestController is a convenience meta-annotation combining @Controller and @ResponseBody, which automatically serializes returned Java objects into JSON/XML payloads.
Q9. What is Spring Data JPA and how do derived query methods work?
Foundation • 0-2 Yrs
Spring Data JPA reduces boilerplate data access code. By extending JpaRepository, developers get CRUD and pagination out-of-the-box. Derived query methods parse method names (e.g., findByEmailAndStatus(String email, String status)) into SQL queries automatically at runtime.
Q10. What is Microservices Architecture and how does it differ from Monolithic?
Foundation • 0-2 Yrs
A Monolith bundles all business modules into a single unified deployment unit sharing a central database (difficult to scale, single point of failure). Microservices decompose applications into independently deployable, loosely coupled services communicating via lightweight protocols (REST, gRPC, Kafka) with decentralized data storage.
Q11. What is an API Gateway and what core responsibilities does it handle?
Foundation • 0-2 Yrs
An API Gateway (e.g., Spring Cloud Gateway) is the single entry point for all client requests. Responsibilities: Request routing, SSL termination, Authentication & Authorization, Rate Limiting, Cross-Origin Resource Sharing (CORS), and request/response transformation.
Q12. What is Service Discovery and how does Netflix Eureka work?
Foundation • 0-2 Yrs
In dynamic cloud environments, service instances scale up and down with dynamic IP addresses. Service Discovery acts as a phonebook. Eureka Server registers active services; Eureka Clients periodically register their IP/port (heartbeats) and resolve other services dynamically by service name.
Q13. What is a Circuit Breaker (Resilience4j) in microservices?
Foundation • 0-2 Yrs
A Circuit Breaker prevents cascading failures when a downstream service becomes unresponsive. States: Closed (normal traffic), Open (failure threshold breached, requests immediately fail-fast and invoke fallback methods), and Half-Open (trial requests test downstream recovery).
Q14. What is the difference between synchronous REST and asynchronous event-driven communication?
Foundation • 0-2 Yrs
Synchronous (REST/HTTP): Client sends request and blocks/waits for immediate response, tightly coupling service availability and increasing latency chains. Asynchronous (Kafka/RabbitMQ): Producer publishes event to a message broker and immediately continues; consumers process events independently, ensuring high decoupling and resilience.
Q15. What is Spring Profiles and how do you activate them?
Foundation • 0-2 Yrs
Spring Profiles allow segregating application configurations for different environments (dev, test, prod) via application-{profile}.properties. Activate via: spring.profiles.active=prod in application.properties or JVM argument -Dspring.profiles.active=prod.