jeudi 8 février 2018

@DataJpaTest scanning entity of external jar

I have a multiple module project

root 
+-- common
+-- webProject

And, I have tried to test on webProject

@RunWith(SPringRunner.class)
@DataJpaTest 
@SpringBootTest(classes = {XxxService.class})
public class XxxServiceTest { 
    @Autowired
    XxxService xxxService;

    @Test
    public void test(){
        xxxService.method();
        ...
    }
}  

XxxServiceTest is located in webProject but, XxxService, XxxRepository are located in common module.

So, It couldn't get beans of entity, repository

In conclusion, How can I get entity and repository of external jar?

Aucun commentaire:

Enregistrer un commentaire