查阅相关资料后发现,是mybaits_config.xmll连接池的连接语句:
单元测试输出如下错误信息:
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure
**"jdbc:mysql://localhost:3306/mysql?useUnicode=true&characterEncoding=utf-8&useSSL=True"**
原来是useSSL的安全验证方式,改为false就可以了;
"jdbc:mysql://localhost:3306/mysql?useUnicode=true&characterEncoding=utf-8&useSSL=false"
还有要注意在xml中&要转义就是写成“ &;”
之前就一直找不到问题发生在哪;还有一种可能连接失败,就是mysql驱动,更换对应的驱动修好了