Spring Boot Starters — Spring Technical Interview Questions & Answers
Curated dependency bundles like spring-boot-starter-web.
Spring Boot Starters
- A starter is one dependency that brings a whole feature set at matching versions.
- spring-boot-starter-web: MVC + embedded Tomcat + JSON support.
- spring-boot-starter-data-jpa: Spring Data JPA + Hibernate.
- spring-boot-starter-security: Security defaults.
- spring-boot-starter-test: Testing libraries for unit/integration tests.
- Benefit: You do not hunt many library versions yourself.
- Adding random libraries with conflicting versions instead of using starters.
- Give spring-boot-starter-web as your example and list what it includes.
Technical Interview Tip: Starter = curated dependency bundle. Example: starter-web.
Code Examples for Spring Boot Starters
Spring Boot Starters — working example
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication // @Configuration + @EnableAutoConfiguration + @ComponentScan
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
// pom.xml / build idea:
// spring-boot-starter-web pulls Tomcat + Spring MVCSpring Boot Starters — @SpringBootApplication boots auto-config, component scan, and the app context; starters are curated dependency bundles.
How to Explain Spring Boot Starters to an Interviewer
What is Boot Starters (sb dependencies)?
Used for a tiny REST app localhost:8080 Not just the heading
Give one small example of Boot Starters (sb dependencies).
@SpringBootApplication + one controller Curated dependency bundles like spring-boot-starter-web
What mistake do beginners make with Boot Starters (sb dependencies)?
calling Boot ‘just Spring XML’ Show the fix
Where do you use Boot Starters (sb dependencies)?
localhost:8080 a tiny REST app