why @SpringBootTest does not load the context


I was using @SpringBootTest annotation to run integration tests. but it suddenly stopped working! it does not load the context anymore, it just runs as a unit test and all injected beans are null. I do not remember what change I made. so, what can cause this problem?

  • the Spring Boot version is 2.3.

  • The context is loaded by adding @RunWith(SpringRunner.class).


the problem was solved. the @Test annotation was not the correct one! It should be org.junit.jupiter.api.Test. stupid IDE auto import!

Answered By – mhrsalehi

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published