Starters là các dependency "gói sẵn" — thêm 1 starter kéo theo tất cả lib cần thiết và auto-configuration tương ứng. Không cần tự quản lý từng dependency và version.
Starter phổ biến:
| Starter | Gộp gì |
|---|---|
spring-boot-starter-web | Spring MVC + Tomcat + Jackson |
spring-boot-starter-data-jpa | Spring Data JPA + Hibernate + HikariCP |
spring-boot-starter-security | Spring Security |
spring-boot-starter-test | JUnit 5 + Mockito + AssertJ |
spring-boot-starter-actuator | Micrometer + Actuator endpoints |
spring-boot-starter-validation | Jakarta Bean Validation + Hibernate Validator |
spring-boot-starter-data-redis | Spring Data Redis + Lettuce |
<!-- Chỉ cần khai báo 1 artifact -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!-- Không cần version — spring-boot-dependencies BOM quản lý -->
</dependency>BOM (Bill of Materials): spring-boot-dependencies define version của tất cả supported lib → đảm bảo tương thích, không conflict version.
Custom starter: tổ chức cũng có thể tạo internal starter để share config chung (DB connection, auth, logging pattern).
Starters are pre-packaged dependencies — adding one starter pulls in all required libraries and the corresponding auto-configuration. No need to manage individual dependencies and versions.
Common starters:
| Starter | Includes |
|---|---|
spring-boot-starter-web | Spring MVC + Tomcat + Jackson |
spring-boot-starter-data-jpa | Spring Data JPA + Hibernate + HikariCP |
spring-boot-starter-security | Spring Security |
spring-boot-starter-test | JUnit 5 + Mockito + AssertJ |
spring-boot-starter-actuator | Micrometer + Actuator endpoints |
spring-boot-starter-validation | Jakarta Bean Validation + Hibernate Validator |
spring-boot-starter-data-redis | Spring Data Redis + Lettuce |
<!-- Only one artifact needed -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<!-- No version needed — managed by spring-boot-dependencies BOM -->
</dependency>BOM (Bill of Materials): spring-boot-dependencies defines versions of all supported libraries → guarantees compatibility, no version conflicts.
Custom starters: organisations can create internal starters to share common configuration (DB connection, auth, logging patterns).