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
GH-1287 - Support for runtime application module verification.
The spring-modulith-runtime artifact now exposes a `spring.modulith.runtime.verification-enabled` property to initiate application module arrangement verification on application startup. The ApplicationModules instance is bootstrapped asynchronously and any failure is elevated onto the main application thread in the post-singleton-initialization phase. We also register a FailureAnalyzer implementation to give a bit of additional guidance on how to deal with the problem.
Spring Modulith application module verification was enabled and failed! The following violations were detected:
41
+
42
+
%s
43
+
""".formatted(cause.getMessage());
44
+
45
+
varaction = """
46
+
Please fix the architectural violations or disable the runtime verification by setting spring.modulith.runtime.verification-enabled to false or removing it entirely.
Copy file name to clipboardExpand all lines: spring-modulith-runtime/src/main/java/org/springframework/modulith/runtime/autoconfigure/SpringModulithRuntimeAutoConfiguration.java
Copy file name to clipboardExpand all lines: spring-modulith-runtime/src/test/java/org/springframework/modulith/runtime/autoconfigure/SpringModulithRuntimeAutoConfigurationIntegrationTests.java
Copy file name to clipboardExpand all lines: src/docs/antora/modules/ROOT/pages/appendix.adoc
+4Lines changed: 4 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -122,6 +122,10 @@ Usually not recommended in multi-instance deployments as other instances might s
122
122
|`false`
123
123
|Deprecated as of 1.3. Prefer `spring.modulith.events.republish-outstanding-events-on-restart`.
124
124
125
+
|`spring.modulith.runtime.verification-enabled`
126
+
|`false`
127
+
|Whether to verify the application module arrangement during application startup. Requires the `spring-modulith-runtime` artifact on the classpath. For more information, see xref:runtime.adoc#setup[the section on Spring Modulith's runtime support] for details.
|This can either be one of the predefined values `uncommitted-changes`, `reference-commit`, `default` or the fully-qualified class name of a `FileModificationDetector` that will be used to inspect which files of the projects have been changed.
Copy file name to clipboardExpand all lines: src/docs/antora/modules/ROOT/pages/runtime.adoc
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -39,6 +39,7 @@ Adding this JAR will cause Spring Boot auto-configuration to run that registers
39
39
40
40
* An `ApplicationModulesRuntime` that allows to access the `ApplicationModules`.
41
41
* A `SpringBootApplicationRuntime` to back the former bean to detect the main application class.
42
+
* A `RuntimeApplicationModuleVerifier` to verify the application module arrangement on startup and abort it if violations are detected, only if `spring.modulith.runtime.verification-enabled` is configured to `true`.
42
43
* An event listener for https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#features.spring-application.application-events-and-listeners[`ApplicationStartedEvent`]s that will invoke xref:runtime.adoc#application-module-initializer[`ApplicationModuleInitializer`] beans defined in the application context.
0 commit comments