运行 Test 测试类的时候遇到这种情况
它让我加测试类注解指定要加载的 SpringBoot 主程序类
package com.futao;
import com.futao.mapper.EmpMapper;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest(classes = SpringbootMybatisCrudApplication.class)
class SpringbootMybatisCrudApplicationTests {
@Autowired
private EmpMapper empMapper;
@Test
void testDelete() {
empMapper.delete(15);
}
}
我没加,直接把 target 文件删除了,重新运行测试类
就成功了