org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner ...
idea运行的时候出现错误:
org.springframework.test.context.junit4.SpringJUnit4ClassRunner - SpringJUnit4ClassRunner constructor called with [class com.imooc.repository.ProductCategoryRepositoryTest]
解决的方法:
1、数据库连接超时:设置最长的连接时间。
在 my.ini 文件末尾添加:
wait_timeout=31536000
interactive_timeout=31536000
保存,重启。
2、因为数据库是在本地安装的,运行访问的是虚拟机,但是我们的虚拟机并没有安装数据库(只针对这种情况),所以写以ip的形式写是会报错的。
写成 localhost:对应的接口 就可以访问。
(在这里我的问题处理掉了。)
3、检查数据库是否公开权限:
进入数据库执行下面的语句:
<!-- create user '新创建的数据库名'@'主机' identified by '密码';-->
grant all privileges on 数据库名(或者写*).表名(或者写*) to '赋予权限的用户'@'主机(或者写%)' identified by '密码';
all privileges 表示授予所有的权限。
dentified by '密码':没有密码为空的可以不用写。