问题
Is there a way to default ignore all fields except explicitly included in Javers? I'm trying to persist CGLib proxy objects, and it's picking up all of the CGLib fields along with the @Entity fields. So what I think would work better is ignore by default, and an annotation/config to say "use these fields".
I've also tried .withMappingStyle(MappingStyle.BEAN) which doesn't seem to make a difference.
回答1:
There is no such option but
you can ignore these CGLib proxy fields globally by type (if they have some meaningful types) using
JaversBuilder.registerIgnoredClass(Class<?> ignoredClass)
I don't recommend committing CGLib proxy objects directly to JaVers. For Hibernate we have unproxy hook, see http://javers.org/documentation/domain-configuration/#hooks You can implememt unproxy hook for your ORM
来源:https://stackoverflow.com/questions/36317181/javers-default-ignore-instead-of-default-include