Spring Boot Interview Questions
1. Spring Boot Fundamentals
• What is Spring Boot, and how does it differ from the Spring Framework?
• What are the key features of Spring Boot?
• What is the purpose of application.properties or application.yml?
• How does Spring Boot simplify dependency management?
• What is auto-configuration in Spring Boot, and how does it work?
• What are @SpringBootApplication and its components (@Configuration,
@ComponentScan, @EnableAutoConfiguration)?
• What is the purpose of the @SpringBootApplication annotation?
• What are different types of dependency injections in Spring Boot?
• How do you enable and use profiles in Spring Boot?
2. Spring Boot Annotations
• What is the difference between @Component, @Service, and @Repository?
• What is @RestController, and how does it differ from @Controller?
• How does @RequestMapping work? What are @GetMapping, @PostMapping, etc.?
• What is @Bean, and how is it used in Spring Boot?
• Explain the use of @Qualifier and @Primary.
• What is the purpose of @Transactional?
• What is @Value, and how is it used to inject values?
• How do @ConfigurationProperties and @PropertySource work?
• What is @SpringBootApplication, and why is it used?
• What is @Lazy, and when should it be used?
3. Spring Boot REST API
• How do you create a RESTful API in Spring Boot?
• What are the different ways to handle exceptions in Spring Boot?
• What are the different HTTP methods used in RESTful APIs?
• What is ResponseEntity, and when should you use it?
• How can you test a Spring Boot REST API using Postman?
• What are the different ways to handle pagination and sorting in Spring Boot REST
APIs?
4. Spring Data JPA
• What is Spring Data JPA, and how does it simplify database interactions?
• What are derived query methods in Spring Data JPA?
• Why JPA is better than JDBC?
• How do you write custom JPQL and native queries in Spring Boot?
• What is the purpose of @Entity, @Table, @Column, and @Id annotations?
• How do you perform transactions in Spring Boot JPA?
5. Spring Boot Security
• How do you implement authentication and authorization in Spring Boot?
• What is Spring Security, and how does it work?
• How do you implement JWT-based authentication in Spring Boot?
• What is OAuth2, and how does Spring Boot support it?
• How do you secure REST APIs in Spring Boot?
• What are security filters, and how do they work in Spring Security?
6. Microservices with Spring Boot
• What is a microservices architecture, How is it different from Monolithic? and how
does Spring Boot support it?
• How do you implement service discovery using Eureka?
• How do you handle inter-service communication in microservices?
• What are API gateways, and how do they work with Spring Boot?
7. Spring Boot Performance Tuning
• How do you optimize a Spring Boot application for better performance?
• What is the role of caching in Spring Boot?
• How do you configure logging in a Spring Boot application?
• How can you reduce memory footprint in a Spring Boot application?
• How do you handle database connection pooling in Spring Boot?
• What is lazy loading, and how does it impact performance?
8. Advanced Spring Boot Concepts
• What is Spring Boot Actuator, and how is it used?
• How do you monitor a Spring Boot application using Actuator?
• What is Spring Boot DevTools, and how does it help in development?
• Types of scopes for sping Beans and explain the difference.