-
Notifications
You must be signed in to change notification settings - Fork 140
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Module-internal dependencies rejected if allowed dependencies defined explicitly #660
Comments
Is there any chance you provide a minimal, complete reproducer? While it's obvious that a module-internal dependency should not be reported as invalid, I still don't quite get which class that's logically assigned to the Am I deducing right, that the processing of |
Nevermind the reproducer. Got it already. |
I was about to give you the reproducer :) Your understanding is correct. |
…encies. As we process a type's entire type hierarchy for dependencies we might discover a foreign module's internal dependencies for modules that declare allowed dependencies explicitly. Explicitly declared dependencies so far solely verified the target being explicitly listed, which, for internal dependencies does not make sense. We now immediately start checking the source and target modules to be equivalent, in which case we can skip any further processing.
This should be fixed now. I've also added a backport into 1.2.x via GH-661 and will add further ones for 1.1.x and 1.0.x. Feel free to give the 1.2.1 snapshots a try. |
I verified that my case works well with version 1.2.1-SNAPSHOT. |
Hi,
I came across issue where verification of application module dependencie fails even though it should not. Consider following example:
Packages structure
ProductRepository
is interface with instance methodsave(Product product)
.MongoDbProductRepository
is concrete class implementingProductRepository
interface.Expected: Verification should pass.
Actual: Verification fails with message "org.springframework.modulith.core.Violations: - Module 'product' depends on named interface(s) 'product :: repository' via com.example.demo.product.repository.ProductRepository -> com.example.demo.product.repository.Product. Allowed targets: none."
Hint:
The reason is that
QualifiedDependency.fromMethodsOf(JavaClass source)
method actually analyzes methodProductRepository.save(Product product)
for passed argument ofMongoDbProductRepository
.Exact problematic line of code: https://github.com/spring-projects/spring-modulith/blob/main/spring-modulith-core/src/main/java/org/springframework/modulith/core/ApplicationModule.java#L1124
The text was updated successfully, but these errors were encountered: