You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This works fine, modulith detects module-a as a separate module when running the application. However, for module-specific tests which use @ApplicationModuleTest in module-a we get the following error:
java.lang.IllegalStateException: Unable to find a @SpringBootConfiguration, you need to use @ContextConfiguration or @SpringBootTest(classes=...) with your test
When the class annotated with @SpringBootApplication is in the same maven module as the @ApplicationModuleTest, everything works as expected.
Of course, I could use @SpringBootTest instead and configure it via classes=... or a @ContextConfiguration. By using this approach, I would lose the automatic slicing of the context from @ApplicationModuleTest and other benefits (like module structure verification, bootstrap mode etc.).
TLDR: Is it possible to use ApplicationModuleTests when each Module is defined in its own maven module? Or is this annotation obsolete in such a scenario?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
In our project, we'd like to put each modulith module into a separate maven module. The project structure looks equivalent to the following:
Packages are structured this way:
This works fine, modulith detects
module-a
as a separate module when running the application. However, for module-specific tests which use@ApplicationModuleTest
inmodule-a
we get the following error:When the class annotated with
@SpringBootApplication
is in the same maven module as the @ApplicationModuleTest, everything works as expected.Of course, I could use
@SpringBootTest
instead and configure it viaclasses=...
or a@ContextConfiguration
. By using this approach, I would lose the automatic slicing of the context from@ApplicationModuleTest
and other benefits (like module structure verification, bootstrap mode etc.).TLDR: Is it possible to use ApplicationModuleTests when each Module is defined in its own maven module? Or is this annotation obsolete in such a scenario?
Beta Was this translation helpful? Give feedback.
All reactions