DAO引入mapper接口后,执行报错WARN: Establishing SSL connection without server‘s

具体错:
WARN: Establishing SSL connection without server’s identity verification is not recommended. According to MySQL 5.5.45+, 5.6.26+ and 5.7.6+ requirements SSL connection must be established by default if explicit option isn’t set. For compliance with existing applications not using SSL the verifyServerCertificate property is set to ‘false’. You need either to explicitly disable SSL by setting useSSL=false, or set useSSL=true and provide truststore for server certificate verification
网上解决办法:
jdbc连接串拼接useSSL=false,再次执行又报其他错

再次审查代码,发现没有通过ConnectionFactory去获取链接。ConnectionFactory的作用
利用工厂模式提升代码的重用性
封装注册数据库的驱动和获得数据库的连接
利用配置文件减少硬编码,便于维护

在这里插入图片描述

posted @ 2021-07-29 08:47  韧小钊  阅读(54)  评论(0)    收藏  举报