$ mvn -pl order-fulfillment -am test -Dtest=ModularityTests#verifiesModuleStructure (captured with OrderManagement holding a direct field of type com.ankurm.modulithdemo.inventory.internal.StockRepository) [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0, Time elapsed: 1.768 s <<< FAILURE! -- in com.ankurm.modulithdemo.ModularityTests [ERROR] com.ankurm.modulithdemo.ModularityTests.verifiesModuleStructure -- Time elapsed: 0.120 s <<< ERROR! org.springframework.modulith.core.Violations: - Cycle detected: Slice inventory -> Slice order -> Slice inventory 1. Dependencies of Slice inventory - Method has parameter of type in (InventoryManagement.java:0) - Method calls method in (InventoryManagement.java:44) - Method calls method in (InventoryManagement.java:45) - Method calls method in (InventoryManagement.java:48) 2. Dependencies of Slice order - Constructor (..., StockRepository)> has parameter of type in (OrderManagement.java:0) - Field has type in (OrderManagement.java:0) - Method calls method in (OrderManagement.java:39) - Module 'order' depends on non-exposed type com.ankurm.modulithdemo.inventory.internal.StockRepository within module 'inventory'! OrderManagement declares constructor OrderManagement(OrderRepository, ApplicationEventPublisher, StockRepository) in (OrderManagement.java:0) - Module 'order' depends on non-exposed type com.ankurm.modulithdemo.inventory.internal.StockRepository within module 'inventory'! Method calls method in (OrderManagement.java:39) - Module 'order' depends on non-exposed type com.ankurm.modulithdemo.inventory.internal.StockRepository within module 'inventory'! Field has type in (OrderManagement.java:0) at org.springframework.modulith.core.Violations.and(Violations.java:141) at org.springframework.modulith.core.ApplicationModules.detectViolations(ApplicationModules.java:497) at org.springframework.modulith.core.ApplicationModules.verify(ApplicationModules.java:451) at org.springframework.modulith.core.ApplicationModules.verify(ApplicationModules.java:435) at com.ankurm.modulithdemo.ModularityTests.verifiesModuleStructure(ModularityTests.java:28) [ERROR] Tests run: 1, Failures: 0, Errors: 1, Skipped: 0 One field in OrderManagement produced TWO distinct violation types in the same run: 1. "Cycle detected" - inventory already depends on order (it listens for OrderPlaced, so it necessarily knows about order's event type). Order reaching back into inventory's internals closes a cycle: order -> inventory -> order. Spring Modulith treats module dependencies as a DAG by default; a cycle is a structural violation even before asking whether the specific type reached for was internal. 2. "depends on non-exposed type" - independent of the cycle, StockRepository lives under inventory.internal, which nothing outside the inventory package is allowed to reference, exposed or not. Either violation alone would have failed the build. This one shortcut produced both at once, which is the realistic case: an internal type reached across a boundary usually also reverses or closes a dependency cycle, because the "proper" event-based direction was already established the other way.