79076064

Date: 2024-10-10 20:34:11
Score: 1.5
Natty:
Report link

found that ApplicationModuleListener is annotated with TransactionalEventListener

so end up publish event under @Transactional

@RequiredArgsConstructor
public class EventPublishingService {

  private @NonNull final ApplicationEventPublisher applicationEventPublisher;

  @Transactional
  public void publishEvent(MyApplicationEvent event) {
    applicationEventPublisher.publishEvent(event);
  }
}

and this do the magic work.

Reasons:
  • Has code block (-0.5):
  • User mentioned (1): @Transactionaland
  • Self-answer (0.5):
  • Low reputation (0.5):
Posted by: JPG