In a regular @SpringBootApplication we would expect Spring Boot to scan the root package and all child packages below for components. An @AcrossApplication, however, encourages you to bundle your components in separate modules, and to only treat the application class as a descriptor for which modules should be added.
In fact, if you were to manually add a @ComponentScan directly on the DemoApplication class, starting the application would fail altogether (with a specific error message).
xxxxxxxxxx
@ApplicationModuleTest
@RequiredArgsConstructor
class OrderIntegrationTests {
private final OrderManagement orders;
@Test
void publishesOrderCompletion(PublishedEvents events) {
var reference = new Order();
orders.complete(reference);
// Find all OrderCompleted events referring to our reference order
var matchingMapped = events.ofType(OrderCompleted.class)
.matchingMapped(OrderCompleted::getOrderId, reference.getId()::equals);
assertThat(matchingMapped).hasSize(1);
}
}
https://www.iodigital.com/en/history/foreach/building-a-modular-monolith-with-spring-boot-and-across