🚀 Spring Boot Interview Questions
🔹 Basics & Core Concepts
1. What is Spring Boot? 🤔 How is it different from the Spring Framework?
2. What are the main features of Spring Boot? ⚡
3. Explain the concept of 'convention over configuration' in Spring Boot. 🔧
4. What are the advantages of using Spring Boot for building applications? 💡
5. What is Spring Boot Starter? 🚀 Name some commonly used starters.
6. How does Spring Boot handle configuration? 🛠️ Explain the application.properties or
application.yml.
7. What is @SpringBootApplication annotation? 📝
8. What is the use of the @EnableAutoConfiguration annotation in Spring Boot? 🔄
9. What are the different ways to run a Spring Boot application? ▶️
10. What is the role of pom.xml (for Maven) or build.gradle (for Gradle) in Spring Boot? 📜
🔹 Dependency Injection
1. What is Dependency Injection in Spring Boot? 💉
2. What are the different types of Dependency Injection in Spring? 🔄
3. How does Spring Boot handle bean creation and management? 🧑💻
4. What are the scopes of Spring beans? 🌱
5. What is the difference between @Component, @Service, @Repository, and @Controller
annotations in Spring Boot? 📊
6. What is the difference between @Autowired and @Inject annotations? 🤖
🔹 Spring Boot Auto Configuration
1. What is auto-configuration in Spring Boot? 🔧
2. How does Spring Boot automatically configure beans in the application? ⚙️
3. Explain how to disable specific auto-configurations. ❌
4. What is the role of @ConfigurationProperties in Spring Boot? 🏗️
🔹 Spring Boot Application Properties
1. How do you externalize configuration in Spring Boot? 📦
2. What are application profiles in Spring Boot? How do you manage them? 🎯
3. How would you configure logging in Spring Boot? 🖥️
4. How do you manage multi-environment configuration in Spring Boot? 🌍
🔹 Spring Boot and Spring MVC
1. What is Spring MVC? How is it used in Spring Boot? 🌐
2. What is the role of @RestController and @Controller annotations in Spring Boot? 💻
3. How do you handle exceptions in Spring Boot applications? 🚨
4. What is the use of @RequestMapping, @GetMapping, @PostMapping, etc., in Spring Boot? 📍
5. What are some ways to handle CORS in Spring Boot? 🔄
6. What is Spring Boot's embedded server? Name the different types. 🖧
7. How do you configure and use an embedded Tomcat server in Spring Boot? 🏃♂️
🔹 Spring Boot Testing
1. How do you test Spring Boot applications? 🧪
2. What are the annotations used for unit testing in Spring Boot? ✅
3. Explain the difference between @WebMvcTest and @SpringBootTest. 🧑🏫
4. How do you write integration tests in Spring Boot? 🔗
5. How do you mock beans in Spring Boot testing? 🎭
🔹 Spring Boot Security
1. What is Spring Security? How is it integrated with Spring Boot? 🛡️
2. What are the common Spring Security components?
3. What are the different ways to implement authentication in Spring Boot? 🔑
4. What is the role of @PreAuthorize and @Secured annotations? 🔐
5. How do you configure role-based authorization in Spring Boot? 🏷️
6. What is CSRF (Cross-Site Request Forgery), and how does Spring Security protect against it? 🚫
7. How do you configure HTTP Basic Authentication in Spring Boot? 📡
8. How do you configure JWT (JSON Web Token) authentication in Spring Boot? 🎟️
9. What is the difference between stateless and stateful authentication in Spring Security? ⚖️
10. How does Spring Security handle session management? 🖥️
11. What are Security Filters in Spring Security, and how do they work? 🛠️
12. How do you implement custom authentication and authorization logic in Spring Security? 🤖
13. How can you protect your Spring Boot application from brute-force attacks? 🔐
14. How do you handle OAuth2 and social login (e.g., Google, Facebook) in Spring Security? 🌍
🔹 Spring Boot Data & JPA
1. What is Spring Data JPA? 📊
2. How does Spring Boot integrate with databases? 💾
3. What are Spring Boot’s support for different database configurations? 🏦
4. How do you configure a DataSource in Spring Boot? ⚙️
5. Explain how to use Spring Data repositories in Spring Boot. 📚
6. What is the difference between @Entity, @Table, and @Id annotations? 🏷️
7. How do you handle database migrations in Spring Boot (e.g., with Flyway or Liquibase)? 🛠️
8. What are Spring Boot’s data access features like transaction management, CRUD, etc.? 🔄
🔹 Spring Boot Profiles & Environments
1. What are Spring Profiles? How are they used in Spring Boot? 🌿
2. How do you define multiple profiles in Spring Boot? 🌱
3. What is the role of @Profile annotation in Spring Boot? 📑
4. How do you activate and manage Spring Boot profiles? 🎚️
🔹 Spring Boot Actuator
1. What is Spring Boot Actuator? ⚙️
2. How do you enable and configure Spring Boot Actuator endpoints? 📡
3. What are the common actuator endpoints available in Spring Boot? 📍
4. How can you customize actuator endpoints? ✨
5. How do you secure Spring Boot Actuator endpoints? 🔐
🔹 Spring Boot WebSocket
1. What is WebSocket? How does Spring Boot support WebSockets? 🌐
2. How do you create a WebSocket application using Spring Boot? 🔌
3. What is @ServerEndpoint and how is it used in Spring Boot? 💬
🔹 Spring Boot Microservices
1. How does Spring Boot facilitate the development of microservices? 🌍
2. What is Spring Cloud? How does it relate to Spring Boot? ☁️
3. How would you implement service discovery with Spring Boot (using Eureka)? 🔍
4. What is Spring Cloud Config, and how is it used with Spring Boot? ⚙️
5. How does Spring Boot handle load balancing in a microservice architecture? ⚖️
6. How do you implement Circuit Breaker pattern using Spring Boot (e.g., with Hystrix)? 🚧
🔹 Spring Boot Caching & Performance
1. How can you enable caching in Spring Boot? 🧊
2. How does Spring Boot handle caching with different caching providers (e.g., Redis)? 🔄
3. How do you enable and configure async processing in Spring Boot? ⏳