最近想给公司的 Spring Boot 系统写单元测试,系统是定制化过的。
之前使用的流程是引入 starter-test 后写测试类
@SpringBootTest
public class MyTest {
@Test
void test(){
...
}
}
但是定制化过的 Spring Boot 貌似不支持这种方式
换了很多种方式后发现在注解上加上类就可以了
@SpringBootTest(MyApplication.class)

最近想给公司的 Spring Boot 系统写单元测试,系统是定制化过的。
之前使用的流程是引入 starter-test 后写测试类
@SpringBootTest
public class MyTest {
@Test
void test(){
...
}
}
但是定制化过的 Spring Boot 貌似不支持这种方式
换了很多种方式后发现在注解上加上类就可以了
@SpringBootTest(MyApplication.class)