0

Good Morning everybody,

I am currently facing the problem that my project wants to use weld-junit (https://github.com/weld/weld-junit/blob/master/junit5/README.md) to provide easy unit tests, wit the power of injection and a CDI container. In an isolated context this works great but in combination with spring data JPA, I am currently facing the problem that the repository implementations (generated by spring data) cannot be found in the CDI context of the test, so the injection points cannot be fulfilled. Does anybody has experience by using this combination yet? Wolfs be great to have an example.

Kind regards

  • Last time I checked (years ago) Spring data JPA used a portable CDI extension to work with CDI. Weld-junit needs you to explicitly activate CDI portable extensions with the `@AddExtensions`. So, what I would do, is find the extension class (look into `META-INF/services` of the jar that implements Spring data JPA + CDI integration) and give it to `@AddExtensions`. – Nikos Paraskevopoulos Jul 06 '21 at 07:36
  • May I ask why you use Spring Data JPA with Java EE and not DeltaSpike? https://deltaspike.apache.org/documentation/data.html – Simon Martinelli Jul 06 '21 at 15:18

0 Answers0