How to inject spring beans into the hibernate envers RevisionListener

I am using SpringDataJPA 5.1 and Hibernate 5.3.9 including hibernate-envers. I don’t know how to inject spring beans into the hibernate envers custom RevisionListener.

I have tried

(@Service or @Component)
public class ExtendedRevisionListener implements RevisionListener {

private MyService myService;

void newRevision(Object revisionEntity){

Of course the class is included in the @ComponentScan packages resolution. A problem is that myService is not injected into the listener.

In the hibernate-envers documentation:

As of Hibernate Envers 5.3, dependency injection is now supported for a RevisionListener. This feature is up to the various dependency frameworks, such as CDI and Spring, to supply the necessary implementation during Hibernate ORM bootstrap to support injection. If no qualifying implementation is supplied, the RevisionListener will be constructed without injection.

Unfortunatelly i haven’t found any working example.

Hi @ptakup, can we decide on one place to have this dicsussion? We already begun the discussion at and I don’t mind doing it here instead if you’d prefer. As I mentioned in my follow-up to your comment

  1. Are you using spring-data-envers in your dependencies at all?
    I need to check to see if that library creates any Envers classes such as the Listener rather than letting Envers do it since the process within Envers is to ask Hibernate to perform the DI.
  2. Can you potentially setup a small demo project like I shared in my answer with your setup perhaps we can determine what the difference is?

This functionality works in Hibernate Envers 5.3.9, so this must be something very specific to how your application is configured or the dependencies its pulling in.