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
- 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.
- Freeze existing violations. Record accepted existing violations, reject new ones, and show that a repaired violation cannot return after you update the saved record.
- Enforce a Rust dependency constraint.
Write a
cargo-denypolicy 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
- ArchUnit first steps: terminology, package patterns, and the operations used in the first lessons.
- Freezing workflow and CI: store configuration, review of accepted violations, and automated verification.
- Java and Rust constraint tools: choose a check for package dependencies, module access, public APIs, or service contracts.
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.