Nội dung
Danh sách bài học
- 01~4 phút
Spring Boot & Auto-configuration — tổng quan
Module này mổ cách Spring Boot tự cấu hình: từ starter gom dependency, tới @EnableAutoConfiguration đọc file imports và @ConditionalOn* quyết định bean nào được tạo.
- 02~12 phút
Spring Boot là gì — tại sao ra đời và 5 trụ cột
Spring Boot không phải framework mới mà là 5 lớp đóng gói trên Spring Framework để xoá 60-90 phút boilerplate setup mỗi project. Bài này giải thích bài toán Spring 4, 5 trụ cột Boot, vòng đời SpringApplication.run() kết thúc bằng refresh(), và tại sao 'opinionated' không phải 'lock-in'.
- 03~12 phút
Starter & BOM — tại sao Spring Boot hết dependency hell
Starter là jar rỗng gom transitive dependency; BOM spring-boot-dependencies quản version đồng bộ 200+ thư viện. Bài này giải thích cơ chế vật lý của starter, cách BOM giải bài toán version conflict, bóc spring-boot-starter-web thành từng jar, và excludes tinh chỉnh stack.
- 04~14 phút
Custom Starter — tự viết starter nội bộ và quản lý supply chain
Starter không chỉ là thứ Pivotal viết. Bài này hướng dẫn tự xây custom starter cho team: cấu trúc 2-module (autoconfigure + starter), file AutoConfiguration.imports, naming convention; sau đó bóc supply chain security: CVE scan, SBOM, và chiến lược upgrade để không bị Log4Shell lần 2.
- 05~12 phút
@EnableAutoConfiguration — cơ chế đọc AutoConfiguration.imports và đăng ký BeanDefinition
Bài này bóc một mục tiêu duy nhất: @EnableAutoConfiguration hoạt động ra sao bên dưới — từ annotation đến AutoConfigurationImportSelector, đến đọc file AutoConfiguration.imports từ classpath* mọi jar, đến register BeanDefinition qua BFPP pipeline. Giải thích tại sao Spring Boot dùng file text imports thay @Import thủ công, và tại sao ASM bytecode reader để filter không load class thừa.
- 06~13 phút
@ConditionalOn* family + back-off pattern + autoconfig ordering
Bóc tách 12 annotation @ConditionalOn* trong auto-configuration: cơ chế điều kiện, back-off pattern qua @ConditionalOnMissingBean, thứ tự evaluate qua @AutoConfigureBefore/After, và debug bằng Actuator /conditions.
- 07~30 phút
Mini-challenge: trace 1 request từ main() và log mọi bean tạo
Bài thực hành khép lại phần Spring Boot Foundations — build 1 Boot app nhỏ, instrument logging để trace toàn bộ vòng đời: từ main(), bean nào tạo theo thứ tự, request đi qua filter chain, controller, service, response. Output là 1 sequence diagram thực tế từ log.
- 08~4 phút
Spring Boot & Auto-configuration — tổng kết
Tóm tắt Spring Boot & Auto-configuration.