java.lang.Exception: Method contextLoads() should be public

错误信息
在这里插入图片描述
原因:这是因为Junit4要求测试的方法为public且返回值为void

解决方案:给测试类加上public就可以了
在这里插入图片描述

猜你喜欢

转载自blog.csdn.net/fgets__/article/details/121795467