1.保证测试包结构与main下的相同。 2.由于项目使用的是SpringBoot2.1.3版本,测试类上的注解只有一个@SpringBootTest是不够的,还需要@RunWith(SpringRunner.class)才可以。