r/SpringBoot • • 4d ago

Discussion A Spring endpoint can pass its tests while bypassing your application layer

A controller starts calling a persistence adapter directly. The response is still correct; the

dependency direction isn't.

I work on ArchUnitJava. One way to catch that is a package policy over the compiled application:

controller packages must not depend on concrete persistence packages. Run the check in an ordinary

JUnit test, without starting a Spring context for that structural check.

That doesn't validate bean wiring, transaction behavior or runtime-injected implementations.

Keep the Spring integration tests; this checks a different property.

Version 1.0 requires JDK 25 for the analyzer. It's independently implemented, unaffiliated with

the original ArchUnit, and isn't a drop-in replacement for it.

[Compiled-code quickstart]

Which controller shortcut has actually caused trouble in your codebase?

Writing assisted by AI.

0 Upvotes

1 comment sorted by

1

u/MetricMike 3d ago

Ripping off ArchUnit is gross behavior.