SpringBoot 测试类无法自动注入@Autowired

原来的测试类的注解:
@RunWith(SpringRunner.class)
@SpringBootTest

一直没法自动注入,后来在@SpringBootTest,加入启动类Application后就可以了


@RunWith(SpringRunner.class)
@SpringBootTest(classes = Application.class)

猜你喜欢

转载自blog.csdn.net/howard789/article/details/81020233