Java Interview Questions – Microservices & Spring Boot

1. [Amazon] What is Spring Boot and how does it simplify Java development?

Answer: Spring Boot is a framework that simplifies Java application development by providing auto-configuration, embedded servers, and dependency management.


2. [Google] What is the difference between Spring Boot and Spring Framework?

Answer: Spring Boot provides opinionated defaults and reduces boilerplate code, while Spring Framework requires manual configuration.


3. [Microsoft] What is the purpose of @SpringBootApplication?

Answer: It combines @Configuration, @EnableAutoConfiguration, and @ComponentScan annotations.


4. [Netflix] How do you handle exceptions in Spring Boot?

Answer: Use @ControllerAdvice and @ExceptionHandler.


5. [Facebook] What is the difference between @RestController and @Controller in Spring Boot?

Answer: @RestController is a combination of @Controller and @ResponseBody, making it suitable for REST APIs.


6. [Oracle] What is the role of application.properties in Spring Boot?

Answer: It is used for configuring application properties like database connection, server port, and logging.


7. [Uber] How does Spring Boot manage database transactions?

Answer: It uses @Transactional to manage transactions automatically.


8. [Deloitte] What is Spring Boot Actuator?

Answer: It provides production-ready features like monitoring, metrics, and health checks.


9. [JP Morgan] What is the difference between Monolithic and Microservices architecture?

Answer: Monolithic applications have a single codebase, while Microservices break an application into smaller, independent services.


10. [Goldman Sachs] What is the purpose of Eureka Server in Spring Boot?

Answer: Eureka Server is used for service discovery in a microservices architecture.


11. [Amazon] What is Zuul in Spring Cloud?

Answer: Zuul is an API Gateway used for routing and filtering requests in microservices.


12. [Google] What is Feign Client in Spring Boot?

Answer: Feign Client simplifies HTTP API calls by automatically generating REST clients.


13. [Microsoft] What is Circuit Breaker in microservices?

Answer: Circuit Breaker (e.g., Resilience4j) prevents cascading failures by blocking requests to failing services.


14. [Netflix] How does Load Balancing work in Spring Boot?

Answer: Load balancing can be achieved using Ribbon or Spring Cloud LoadBalancer.


15. [Facebook] How do you secure a REST API in Spring Boot?

Answer: Use Spring Security with JWT or OAuth2.


16. [Oracle] What is Swagger in Spring Boot?

Answer: Swagger is a tool for API documentation and testing.


17. [Uber] What is the purpose of @EnableFeignClients?

Answer: It enables Feign clients for HTTP communication between microservices.


18. [Deloitte] How does Kafka integrate with Spring Boot?

Answer: Use spring-kafka dependency and @KafkaListener to consume Kafka messages.


19. [JP Morgan] What is the role of @Value annotation in Spring Boot?

Answer: It injects values from application.properties into Spring components.


20. [Goldman Sachs] What is the difference between synchronous and asynchronous communication in microservices?

Answer: Synchronous requires waiting for a response, whereas asynchronous (Kafka, RabbitMQ) processes requests in the background.