spring-modulith icon indicating copy to clipboard operation
spring-modulith copied to clipboard

A shared module unnecessarily lists itself as an allowed target

Open nikolamicic21 opened this issue 1 month ago • 1 comments

A module that @Modulithic(sharedModules = …) names, and that declares allowedDependencies = {}, gets this message:

Module 'shared' depends on module 'order' via … Allowed targets: shared.

ApplicationModule#getAllowedDependencies adds all shared modules, and the module itself is not excluded (source https://github.com/spring-projects/spring-modulith/blob/2.1.1/spring-modulith-core/src/main/java/org/springframework/modulith/core/ApplicationModule.java#L524-L529).

A dependency inside the same module is never checked, so the entry has no effect on the result. It only appears in the message. For a non-shared module with allowedDependencies = {}, the message says "Allowed targets: none."

Is this intended, or should the module itself be left out of its own allowed dependencies?

A minimal project is attached.

demo.zip

nikolamicic21 avatar Oct 07 '26 12:10 nikolamicic21

That's fixed. Please give the snapshots a try.

odrotbohm avatar Oct 09 '26 09:10 odrotbohm