Injecting a Spring dependency into a JPA EntityListener

A hack to inject dependencies on stateless beans, is to define the dependency as “static”, create a setter method so that Spring can inject the dependency (assigning it to the static dependency). Declare the dependency as static. static private EvenementPliRepository evenementPliRepository; Create a method so that Spring can inject it. @Autowired public void init(EvenementPliRepository evenementPliRepository) … Read more