Skip to content

v0.4.0 — All-Version Spring Boot Production Guardrail (3-Pillar Architecture)

Latest

Choose a tag to compare

@wkd09 wkd09 released this 05 Dec 16:01

What's New in v0.4.0

modern-java-guidance (mjg) evolves from a Java 21 / Boot 3 modernization linter into an all-version (Java 8–25, Spring Boot 2.7–3.4+) Spring Boot production guardrail across 3 pillars—still with zero third-party Python dependencies.

Pillar 1 — 14 Version-Independent Production Footguns

Catches real outage & security causes that javac compiles with zero warnings (works on Boot 2.7 through Boot 3.4+):

  • AOP & Transactions: TX-001 (@Transactional on private/final), TX-002 (JDK checked throws without rollbackFor), CONC-001 (@Async on private/final)
  • JPA / Hibernate: JPA-001 (Lombok @Data on @Entity), JPA-002 (@ManyToOne/@OneToOne missing FetchType.LAZY)
  • Spring & Precision: SPRING-001 (new ObjectMapper() in services), JAVA-020 (new BigDecimal(0.1) double literal), OPS-001 (e.printStackTrace())
  • Security & WebFlux: SEC-001 (SQL string concatenation in JdbcTemplate/createNativeQuery, ignoring literal+literal concat), SEC-002 (CORS allowedOrigins("*") + allowCredentials(true) startup crash), REACT-001 (.block() in WebFlux-only apps)
  • Spring Config (application*.yml/.properties): CFG-001 (Actuator * wildcard), CFG-002 (prod ddl-auto: update/create/create-drop), CFG-003 (explicit open-in-view: true)

Pillar 2 — 6 Bidirectional Version Compatibility Guards (COMPAT-001..006)

Protects teams on older Java 8/11/17 or Spring Boot 2.7/3.0–3.3 repos from AI-hallucinated future APIs (activates only when build files declare explicit versions):

  • COMPAT-001: Blocks jakarta.* EE imports on Spring Boot 2.x
  • COMPAT-002: Blocks RestClient / @HttpExchange on Spring Boot < 3.2
  • COMPAT-003: Blocks @MockitoBean / @MockitoSpyBean on Spring Boot < 3.4
  • COMPAT-004: Blocks Virtual Threads / SequencedCollection on Java < 21 (never false-positives on LinkedList.getLast() / Comparator.reversed())
  • COMPAT-005: Blocks record (< 16) and sealed (< 17)
  • COMPAT-006: Blocks .formatted() (< 15) and .stream()...toList() (< 16)

Pillar 3 — Team Config (.mjg.toml), --profile prod, ARCH-001 & mjg init

  • Zero-dependency .mjg.toml loader via Python 3.11+ stdlib tomllib
  • --profile prod (and profile: prod in action.yml) skips pure style rules (JAVA-003, JAVA-004, BOOT-010) so enterprise teams only see real bugs, security, JPA/TX footguns, and version safety
  • mjg init [--profile prod] auto-generates .mjg.toml and suggests ARCH-001 (forbid_controller_repository = true) when a *Service layer exists
  • Supports disable, severity overrides, and [[custom_rules]]

Verification

  • unittest (Python 3.11, 3.12, 3.13): 16/16 passed
  • A/B eval suite: 8/8 passed (100.0%, +87.5 pp vs. 12.5% unguided baseline)
  • Semgrep CI job: 20/20 Java AST rules (semgrep --validate 0 errors, semgrep --test 20/20 passed)
  • GitHub Action E2E job (47539452922): all 5 CI jobs passed