报错记录:springboot报错
1.测试代码如下(发现在无框架下执行成功,在springboot下执行报错了):
public class Test01 {
@Test
public void test01(){
//创建任务对象
TestLock testLock = new TestLock();
//创建线程
Thread t1 = new Thread(testLock,"黄牛1");
Thread t2 = new Thread(testLock,"黄牛2");
Thread t3 = new Thread(testLock,"黄牛3");
Thread t4 = new Thread(testLock,"黄牛4");
//开启线程
t1.start();
t2.start();
t3.start();
t4.start();
}
}
2.解决方法:pop.xml加入下面的依赖坐标
<dependency> <groupId>org.junit.platform</groupId> <artifactId>junit-platform-launcher</artifactId> <scope>test</scope> </dependency>