Spring Interview Cheat Sheet
Spring Interview Cheat Sheet
Basic Level
Intermediate Level
Q: What is @Autowired?
A: Used to inject Spring beans automatically into dependent components.
Q: Difference between @Component, @Service, @Repository, and @Controller?
A: All are beans. Each represents a specific layer: generic, service, DAO, and web controller respectively.
Q: How does Spring Boot handle application properties?
A: Using application.properties or .yml and annotations like @Value or @ConfigurationProperties.
Q: What is Spring Boot DevTools?
A: Tool for hot-reloading and quick feedback during development.
Q: How to configure different environments?
A: Using profiles like application-dev.properties and spring.profiles.active.
Q: What is a Bean in Spring?
A: An object managed by the Spring container.
Q: How is a Spring Boot application deployed?
A: Via an executable JAR with an embedded server or a WAR to an external server.
Advanced Level
Q: What is Auto-Configuration?
A: Spring Boot configures beans automatically based on classpath and properties.
Q: What is CommandLineRunner?
A: An interface for running logic after the Spring context is initialized.
Spring Boot & Spring Framework Interview Cheat Sheet