MindIQ Academy
1 / 100
Spring Events and Async

Question 1

In a Spring Boot 3 application, what happens when this code publishes an event?

@Service
class OrderService {
    private final ApplicationEventPublisher publisher;

    OrderService(ApplicationEventPublisher publisher) {
        this.publisher = publisher;
    }

    public void placeOrder(Long orderId) {
        publisher.publishEvent(new OrderPlacedEvent(orderId));
    }
}