I always add the @SpringBootTest
to my test classes when using Spring Boot and my tests work as expected. I wonder what benefit do I get from also adding @RunWith(SpringRunner.class)
, since all over the internet that annotation is being used.
@RunWith(SpringRunner.class)
支持加载 ApplicationContext 并将 bean @Autowired
放入您的测试实例中。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.