How to integrate spring-data-envers into my projec

2019-09-10 06:58发布

Hi I need to integrate this project available at https://github.com/spring-projects/spring-data-envers into my project. I'm using spring-boot to manage all my configurations so I don't know how to add the line : into my project. I added the dependency spring-data-envers into my project but in order to use the repository that spring-data provides something else has to be done that I'm not seeing. Please give me a hint on how to do this with spring-boot

2条回答
Rolldiameter
2楼-- · 2019-09-10 07:21

Repository itself has an example how to use it.

In general you need to add special Hibernate annotation @Audited to entities. And your repository interfaces should extend additional interface EnversRevisionRepository.

查看更多
Melony?
3楼-- · 2019-09-10 07:33

Add this:

@EnableJpaRepositories(repositoryFactoryBeanClass = EnversRevisionRepositoryFactoryBean.class)

We use this:

@Configuration
@EnableJpaAuditing(auditorAwareRef = "auditorAwareImpl")
@EnableJpaRepositories(repositoryFactoryBeanClass = EnversRevisionRepositoryFactoryBean.class)
@EnableTransactionManagement
public class DataRestConfig
    extends RepositoryRestMvcConfiguration {
}
查看更多
登录 后发表回答