当前位置: 动力学知识库 > 问答 > 编程问答 >

How to integrate spring-data-envers into my project

问题描述:

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

网友答案:

Add this:

@EnableJpaRepositories(repositoryFactoryBeanClass = EnversRevisionRepositoryFactoryBean.class)

We use this:

@Configuration
@EnableJpaAuditing(auditorAwareRef = "auditorAwareImpl")
@EnableJpaRepositories(repositoryFactoryBeanClass = EnversRevisionRepositoryFactoryBean.class)
@EnableTransactionManagement
public class DataRestConfig
    extends RepositoryRestMvcConfiguration {
}
网友答案:

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.

分享给朋友:
您可能感兴趣的文章:
随机阅读: