Demo: enforcing boundaries with ArchUnit
On This Lesson 3 topics
This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.
In this lesson
make a forbidden dependency fail the build; prepares MID-010-LAB1.
Draft outline details
Step by step
- In Shop API, define feature packages:
orders,catalog,payments. - Add an ArchUnit test: classes in
orders..must not depend onpayments.internal... - Run it; it passes on the clean codebase.
- Planned mistake: import a
paymentsinternal class fromorders. The test fails with a readable violation. Fix: call the public API ofpaymentsinstead. - Add a layering rule (controllers do not access repositories directly); verify the ArchUnit version for the API.
Practice
Apply this lesson with the module's lab, exercises and quiz.
Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.