1

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

Prasana Ramesh
  • 97
  • 3
  • 11
  • 2
    There's a little guide for spring-boot and spring-data-envers here: http://stackoverflow.com/a/29308586/1098564 note: spring-data-envers is not a well maintained project and conflicts with querydsl (if you use that) – sdoxsee Mar 13 '16 at 13:51

2 Answers2

4

Add this:

@EnableJpaRepositories(repositoryFactoryBeanClass = EnversRevisionRepositoryFactoryBean.class)

We use this:

@Configuration
@EnableJpaAuditing(auditorAwareRef = "auditorAwareImpl")
@EnableJpaRepositories(repositoryFactoryBeanClass = EnversRevisionRepositoryFactoryBean.class)
@EnableTransactionManagement
public class DataRestConfig
    extends RepositoryRestMvcConfiguration {
}
nevster
  • 6,271
  • 7
  • 35
  • 42
0

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.

Anton N
  • 2,317
  • 24
  • 28
  • My question was not how to use envers. I wanted to know how to add the jpa factory bean to my project. I found my answer. Apparently we have to use @EnableJpaRepositories annotation – Prasana Ramesh Mar 13 '16 at 14:05