title: Events in Spring Boot
body: <p>Is it possible to use events in Spring Boot? I need to execute one method but without waiting for return. I'm trying to use this:</p>
  
  <pre class="lang-java prettyprint-override"><code>public class GerarSeloEvent extends ApplicationEvent {
  
      private TbPedido pedido;
      private Integer cdCartorio;
  
      public GerarSeloEvent(Object source, TbPedido pedido, Integer cdCartorio) {
          super(source);
          this.pedido = pedido;
          this.cdCartorio = cdCartorio;
      }
  
      public TbPedido getPedido() {
          return pedido;
      }
  
      public Integer getCdCartorio() {
          return cdCartorio;
      }
  }
  
  @Component
  public class GerarSeloListener implements ApplicationListener&lt;GerarSeloEvent&gt; {
      @Autowired
      SeloService seloService;
      @Override
      public void onApplicationEvent(GerarSeloEvent event) {
          seloService.gerarSelos(event.getPedido(), event.getCdCartorio());
      }
  }
  </code></pre>
  
  <p>and my call</p>
  
  <pre><code>GerarSeloEvent gerarSelos = new GerarSeloEvent(this, pedido, cdCartorio);
  EnviarEmailPedidoEvent enviarEmail = new EnviarEmailPedidoEvent(this, pedido);
  publisher.publishEvent(gerarSelos);
  </code></pre>
  
  <p>But my code waits to return anything to my front-end. I need one async event.</p>