Starter là dependency descriptor gom nhiều package cùng concern lại — đã test tương thích version với nhau.
<!-- Thay vì liệt kê hàng chục dependency riêng lẻ -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- → tự kéo Spring MVC + Tomcat embedded + Jackson + Validation, version đã test -->Starter phổ biến:
- spring-boot-starter-web — REST API, MVC
- spring-boot-starter-webflux — reactive
- spring-boot-starter-data-jpa — JPA + Hibernate
- spring-boot-starter-security — Spring Security
- spring-boot-starter-test — JUnit 5 + Mockito + AssertJ
- spring-boot-starter-actuator — production monitoring
Lợi ích: version consistency (không lo conflict), giảm boilerplate, setup nhanh, convention-over-configuration.
Tự viết starter: đặt tên mycompany-spring-boot-starter (không phải spring-boot-starter-mycompany — reserve cho Spring official).
A starter is a dependency descriptor bundling many packages of the same concern — versions already tested for compatibility.
<!-- Instead of listing dozens of separate dependencies -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<!-- → pulls Spring MVC + embedded Tomcat + Jackson + Validation, all tested versions -->Common starters:
- spring-boot-starter-web — REST APIs, MVC
- spring-boot-starter-webflux — reactive
- spring-boot-starter-data-jpa — JPA + Hibernate
- spring-boot-starter-security — Spring Security
- spring-boot-starter-test — JUnit 5 + Mockito + AssertJ
- spring-boot-starter-actuator — production monitoring
Benefits: version consistency (no conflicts), reduced boilerplate, fast setup, convention-over-configuration.
Writing your own starter: name it mycompany-spring-boot-starter (NOT spring-boot-starter-mycompany — reserved for official Spring).