-
Notifications
You must be signed in to change notification settings - Fork 148
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
Application module test Includes unwanted beans in test run #320
Comments
As in #319 we have modules that start with the same string. However, our issue persists if we rename the module packages. Deleting the wrongly included module only leads to other wrong modules being included in the test slice. |
Can you share the package structure of your application? |
We have a very simple package structure. Every module is structured in the same way (controllers, application, domain, infrastructure). The top-level package of a module may contain classes that are accessed by other modules. We define a Our tests are organized in the same package structure. Integration tests are defined in the top-level package of a module.
|
Is there any Spring configuration within |
I identified the commit that broke our tests. The only thing I changed in core was to include a new module package in The newly created module contains a couple configuration classes that define beans which are only used inside the module. The module had no dependencies on other modules at the time. |
Ok, I removed the added configuration in core which resolved the issue. This seems very odd to me and doesn't explain why it works with the other modules. |
We currently only reconfigure the autoconfiguration which is considered by the component scanning automatically set up by Spring Boot. Every other, manual configuration that triggers a dedicated component scanning (e.g., I have a prototypical fix for this that deploys a How quickly would you be able to try a 1.1 snapshot? |
We now explicitly drop all beans resulting in a type that's contained in an application module *not* included in the current test bootstrap.
Tonight :) We are using |
Fix is in, snapshots should be available. Enabling trace logging should output the bean names that are dropped through that particular mechanism. |
Your fix works as expected. Our tests run without problems now ;) |
We have encountered an issue with the annotation @ApplicationModuleTest, where the test appears to require more beans (from other modules) than expected. The module under test only depends on the
Core
module which is correctly picked up in the logs. Please see the stack trace and code snippets below for more details.We use version
1.1.0-SNAPSHOT
.Modulith config from main Application java file
Test
Stacktrace:
Modulith Test logs
The text was updated successfully, but these errors were encountered: