I want to inject a Spring-Bean into every Entity returned by a repository implemented with Spring-Data (using JPA / Hibernate).
What is the best way to do this?
I have found two options:
write a wrapper for the Spring Data repositories. This is cumbersome because it would mean overwriting lots of methods.
write an JPA CallbackListener. I'd rather not depend on JPA/Hibernate and prefere something based on Spring, since it would allow me to use the same approach for Entities not created by JPA/Hibernate
Is there a way to do this purely based on Spring(Data) without drowning in boilerplate code for overwriting dozens of methods?