OLHub

Spring Boot Foundations

Bóc tách auto-configuration, starter dependencies, externalized config, profiles, logging. Sau module này bạn hiểu mọi 'magic' của Spring Boot ở mức bytecode.

7 bài · ~180 phútMiễn phí

Nội dung

Danh sách bài học

  1. 01

    Spring Boot giải quyết gì — opinionated defaults 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: auto-config, starter, embedded server, Actuator, Spring Boot CLI/build plugin. Bài này bóc bài toán Boot ra đời để giải quyết, đối chiếu code Spring 4 vs Boot 3, vòng đời SpringApplication.run(), và sự khác biệt giữa 'opinionated' và 'lock-in'.

    ~25 phút
  2. 02

    Starter dependencies — bóc tách spring-boot-starter-web

    Starter là 'meta-dependency' rỗng pull theo curated transitive jars. Bài này bóc spring-boot-starter-web ra từng jar, giải thích BOM (spring-boot-dependencies), spring-boot-starter-parent vs import scope, cách Pivotal quản 200+ lib version, và cách tự viết starter custom cho team.

    ~25 phút
  3. 03

    Auto-configuration deep dive — bóc tách @EnableAutoConfiguration

    Auto-configuration là magic chính của Spring Boot. Bài này bóc cơ chế ở mức bytecode: AutoConfigurationImportSelector, file AutoConfiguration.imports, 12 family annotation @ConditionalOn*, autoconfig ordering với @AutoConfigureBefore/After, debug autoconfig với /actuator/conditions, và viết autoconfig của riêng bạn.

    ~28 phút
  4. 04

    application.properties vs application.yml — externalized configuration

    Boot có 17 nguồn property xếp theo thứ tự ưu tiên. Bài này bóc cơ chế PropertySource ordering, properties vs YAML format, @ConfigurationProperties vs @Value, validation, profile-specific files, relax binding cho env var, type-safe binding với records, và pattern config sensitive data qua secrets.

    ~26 phút
  5. 05

    Profiles — dev/staging/prod, profile-specific bean, profile groups

    Profile là cơ chế Boot toggle config + bean theo môi trường. Bài này bóc cách profile activate, @Profile trên @Bean và @Component, profile groups, default profile, multi-document YAML, profile expression (! && ||), profile inheritance, và pattern multi-tenant với profile.

    ~22 phút
  6. 06

    Logging — Logback default, structured logging, log level dynamic

    Boot pre-configure Logback với pattern, level, file rotation. Bài này bóc cấu hình Logback Boot dùng, log level hierarchy, structured logging JSON (Boot 3.4 GA), MDC cho correlation ID, dynamic log level qua Actuator, đổi sang Log4j2, và pattern log production cho ELK/Loki.

    ~24 phút
  7. 07

    Mini-challenge: trace 1 request từ main() và log mọi bean tạo

    Bài thực hành khép lại Module 02 — 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.

    ~30 phút