Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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).

like image 420
mhrsalehi Avatar asked Jan 25 '26 23:01

mhrsalehi


1 Answers

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

like image 123
mhrsalehi Avatar answered Jan 29 '26 13:01

mhrsalehi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!