Injecting a Spring dependency into a JPA EntityListener
I am trying to inject a Spring dependency into an JPA EntityListener . Here is my listener class: @Configurable(autowire = Autowire.BY_TYPE, dependencyCheck = true) public class PliListener { @Autowired private EvenementPliRepository evenementPliRepository; @PostPersist void onPostPersist(Pli pli) { EvenementPli ev = new EvenementPli(); ev.setPli(pli); ev.setDateCreation(new Date()); ev.setType(TypeEvenement.creation); ev.setMessage("Création d'un pli"); System.out.println("evenementPliRepository: " + evenementPliRepository); evenementPliRepository.save(ev); } } Here is my Entity class: