GH-1062 - ApplicationModuleExporter now exposes ApplicationModuleInitializer beans.
This commit is contained in:
@@ -16,13 +16,14 @@
|
||||
package com.acme.myproject.moduleA;
|
||||
|
||||
import org.springframework.context.ApplicationEventPublisher;
|
||||
import org.springframework.modulith.ApplicationModuleInitializer;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author Oliver Drotbohm
|
||||
*/
|
||||
@Component
|
||||
public class ServiceComponentA {
|
||||
public class ServiceComponentA implements ApplicationModuleInitializer {
|
||||
|
||||
private final ApplicationEventPublisher publisher;
|
||||
|
||||
@@ -33,4 +34,7 @@ public class ServiceComponentA {
|
||||
public void fireEvent() {
|
||||
publisher.publishEvent(new SomeEventA("Message"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initialize() {}
|
||||
}
|
||||
|
||||
@@ -23,6 +23,7 @@ import org.junit.jupiter.api.Test;
|
||||
import org.springframework.modulith.core.ApplicationModules;
|
||||
|
||||
import com.acme.myproject.Application;
|
||||
import com.acme.myproject.moduleA.ServiceComponentA;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.jayway.jsonpath.JsonPath;
|
||||
|
||||
@@ -61,4 +62,13 @@ class ApplicationModulesExporterUnitTests {
|
||||
new ObjectMapper().readTree(EXPORTER.toJson());
|
||||
});
|
||||
}
|
||||
|
||||
@Test // GH-1062
|
||||
void fullRenderingListsInitializers() {
|
||||
|
||||
var exported = EXPORTER.toFullJson();
|
||||
|
||||
assertThat((List<String>) JsonPath.compile("$..initializers[*]").read(exported))
|
||||
.containsExactly(ServiceComponentA.class.getName());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user