Spring Boot internals: 30 interview questions 30 questions in 7 chapters
- 01Auto-configuration7 questions
- 02Startup and annotations6 questions
- 03Configuration6 questions
- 04Web4 questions
- 05Data, Actuator, logging, packaging4 questions
- 06Opinion questions3 questions
- 07Sources
Auto-configuration
```java
1. How does Spring Boot decide which auto-configuration to apply? Hard 1 min
2. What happens internally when you add spring-boot-starter-web? Medium 1 min
3. Why does Spring Boot prefer convention over configuration? Easy 1 min
10. What is the role of SpringFactoriesLoader? Hard 1 min
22. Difference between @EnableAutoConfiguration and @Import? Medium 1 min
23. What happens when you exclude an auto-configuration class? Medium 1 min
11. How did Spring Boot remove XML configuration almost completely? Medium 1 min
Startup and annotations
What the docs say:
5. What is the exact startup flow of a Spring Boot application? Hard 1 min
6. Difference between @ComponentScan and @SpringBootApplication? Easy 1 min
8. What happens if two beans of the same type exist without @Qualifier? Medium 2 min
14. What is the complete lifecycle of a Spring Bean? Hard 1 min
18. Difference between a @Configuration class and a normal class? Hard 1 min
20. What is the real use of CommandLineRunner? Easy 1 min
Configuration
It is not "one or the other". The docs: "If you have configuration files with both .properties and YAML format in the same location, .properties takes precedence."
4. How does Spring Boot load application.properties internally? Medium 1 min
9. How does Spring Boot load profile-specific configurations? Medium 1 min
15. How does Spring Boot handle externalized configuration? Medium 1 min
16. What happens if application.yml and application.properties both exist? Medium 1 min
27. How does Spring Boot decide server port priority? Medium 1 min
13. How does Spring Boot manage dependency versions automatically? Medium 1 min
Web
What the docs say:
7. How does Spring Boot detect embedded Tomcat automatically? Hard 1 min
12. Difference between @RestController and @Controller internally? Easy 1 min
28. What happens internally when you hit a REST endpoint? Hard 1 min
21. How does Spring Boot handle exception translation? Medium 1 min
Data, Actuator, logging, packaging
19. How does Spring Boot auto-create a DataSource? Medium 1 min
17. How does Spring Boot integrate with Actuator internally? Hard 1 min
26. How does Spring Boot handle logging by default? Easy 1 min
25. Difference between a fat JAR and a normal JAR? Easy 1 min
Opinion questions
---
24. Why is Spring Boot perfect for microservices? Easy 1 min
29. Why is Spring Boot preferred for cloud-native apps? Easy 1 min
30. What are the most common Spring Boot performance mistakes? Hard 1 min
Sources
- Spring Boot: Creating your own auto-configuration
- Spring Boot: Using auto-configuration
- Spring Boot: Build systems
- Spring Boot: Servlet web applications
- SpringFactoriesLoader javadoc
- Spring Boot 2.7 release notes
- Spring Boot 3.0 migration guide
- Spring Framework: Composing Java configurations
- Spring Framework: Java-based configuration basic concepts
- Spring Boot: SpringApplication
- Spring Boot: Using @SpringBootApplication
- NoUniqueBeanDefinitionException javadoc
- Spring Framework: @Primary
- Spring Framework: Qualifiers
- Spring Framework: Bean lifecycle callbacks
- Spring Framework: Container extension points
- Spring Boot: Externalized configuration
- Spring Boot: Profiles
- Spring Boot: Embedded web servers how-to
- @RestController javadoc
- Spring MVC: Annotated controllers
- Spring MVC: @ResponseBody
- DispatcherServlet: Special bean types
- DispatcherServlet: Processing
- Spring Framework: DAO support
- Spring Boot: SQL databases
- Spring Boot: Actuator endpoints
- Spring Boot: Logging
- Spring Boot: Executable jar format
- The Twelve-Factor App