ArchUnit for Spring Boot

Turn architecture decisions into tests for your Java applications, then carry those constraints into a Rust migration.

Start with familiar controllers, services, and repositories. Write a rule that catches a forbidden dependency, then introduce rules into existing code while you repair old violations gradually.

Start Lesson 1: Catch a forbidden dependency.

Available lessons

  1. Catch a forbidden dependency. Import compiled Java classes and write a rule that prevents controllers from using persistence directly. Add a forbidden reference to prove the rule catches it.
  2. Freeze existing violations. Record accepted existing violations, reject new ones, and show that a repaired violation cannot return after you update the saved record.
  3. Enforce a Rust dependency constraint. Write a cargo-deny policy that rejects a forbidden package dependency. This optional migration track follows lesson 2.

Each lesson includes an exercise you implement yourself. Bring your code and test output back for review before moving on.

Keep nearby

Planned later lessons

Later lessons will cover Spring annotations and JUnit integration, layers and dependency cycles, and adopting rules in a real repository. The Rust track will continue with module rules, public API compatibility, and contracts between Java clients and Rust services.

These lessons are planned; their order will follow the exercises and what needs more practice. See the course direction and progress for the proposed sequence.