Just find out that @Import annotation could be used in unit test of spring boot application to load configurations which are needed for the test. My question is about how correct this approach is. Is there some possible problems or traps here?
For now I found only one difference in behaviour. I have an abstract parent class for all tests with an internal @TestConfiguration static class in it with some common beans for testing. If I use @ContextConfiguration I should explicitly list it in the classes option of this annotation but with @Import it will be loaded automatically without explicit import. That the reason of such behaviour?
Aucun commentaire:
Enregistrer un commentaire