title: Injection in entity listener with Quarkus
body: <p>I'm trying to inject a bean into an entity listener in a Quarkus-application:</p>
  
  <pre><code>@ApplicationScoped
  public class MyEntityListener implements Serializable {
  
      @Inject
      MyService service;
  
      @PrePersist
      @PreUpdate
      public void checkWrite(BaseEntity entity) {
          service.check(entity);
      }
  }
  </code></pre>
  
  <p>But <code>service</code> is always <code>null</code>. Changing scope to <code>@SessionScoped</code> has no effect.</p>
  
  <p>According to this 2 SO-discussions, this should be possible: </p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/10765508/cdi-injection-in-entitylisteners">CDI injection in EntityListeners</a></li>
  <li><a href="https://stackoverflow.com/questions/38582007/how-can-i-use-an-ejb-in-a-entitylistener">How can I use an EJB in a EntityListener?</a></li>
  </ul>
  
  <p>I couldn't find any information about which JPA-version Quarkus is using, but since it is a state-of-the-art-framework I think it is JPA 2.1? </p>
  
  <p>So should this be possible and if yes, what am I doing wrong?</p>