I've got a legacy schema which I'd like to use Spring Data JPA with, and I'm trying to work out if this scenario is possible.
I've code models like:
@Entity
class Entity1 {
...
@CreatedBy
private String createdBy;
...
}
and
@Entity
class Entity2 {
...
@CreatedBy
private Long createdBy;
...
}
I would like to be able to use Spring Data for this, however I can't find a way (so far) to have the auditing support this.
First thing I tried is having two AuditorAware beans, however this results in a multiple bean exception problem. Does anyone know if this is possible at present, and where I need to look for the solution?
Thanks in advance!
Very interesting question, thank you for raising it.
Looking through the code, there is no way to plugin a second AuditorAware bean and have the system select between them by return type. Spring builds even its own internal beans based on this assumption.
You would have to (based on a preliminary research):
Quite a handful :))
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With