GH-87 - Expose module structure as actuator endpoint.

Introduce Spring Modulith Actuator module to expose the application module structure as Spring Boot actuator. This required a Spring Modulith Runtime module to be extracted from the Spring Modulith Observability one. The former now contains the auto-configured ApplicationRuntime and ApplicationModulesRuntime bean instances to be able to bootstrap a ApplicationModules asynchronously on application startup. The actuator module then contains a Spring Boot @Endpoint implementation consuming the ApplicationModules to render JSON describing the application module structure.
This commit is contained in:
Oliver Drotbohm
2022-12-22 20:43:39 +01:00
parent 9dff5cc973
commit c1fc3032b7
34 changed files with 847 additions and 150 deletions

View File

@@ -39,9 +39,9 @@ import com.tngtech.archunit.core.importer.ClassFileImporter;
@TestInstance(Lifecycle.PER_CLASS)
class ModuleUnitTest {
ClassFileImporter importer = new ClassFileImporter();
JavaClasses classes = importer.importPackages("com.acme.withatbean"); //
JavaPackage javaPackage = JavaPackage.of(Classes.of(classes), "");
String packageName = "com.acme.withatbean";
JavaClasses classes = new ClassFileImporter().importPackages(packageName);
JavaPackage javaPackage = JavaPackage.of(Classes.of(classes), packageName);
ApplicationModule module = new ApplicationModule(javaPackage, false);
@@ -69,4 +69,9 @@ class ModuleUnitTest {
assertThat(it.getSources()).isNotEmpty();
});
}
@Test // GH-87
void usesCapitalizedNameAsDisplayNameByDefault() {
assertThat(module.getDisplayName()).isEqualTo("Withatbean");
}
}