Cannot configure Spring Data JPA: Specified class is an interface

前端 未结 1 759
萌比男神i
萌比男神i 2021-01-18 03:18

I\'ve started to use Spring Data JPA. Unfortunately I can\'t configure it. I have Entity class, Repository interface, but when I try to test it, so

1条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-18 04:13

    Your test is annotated with @ContextConfiguration(classes = EmployeeRepository.class)

    However, the classes property of this annotation should reference configurations (class annotated with @Configuration like your AppConfig). So you are launching your test without a configuration for spring-data and your repository.

    If you want to test your repository, you should create a @Configuration with the @EnableJpaRepositories and an in-memory database.

    0 讨论(0)
提交回复
热议问题