为了测试类不会打包, 将测试类放到src/test/java.
1.1、测试实体 使用Entiry注解使实体类为Hibernate所管理。
Sun Oct 29 20:40:43 GMT+08:00 2017 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.
解决方案:在url后加上 &useSSL=true
public static Connection getConnection() throws SQLException {
Connection con = null;
//加上userSSL=true, 解决高版本是否连接SSL
con = DriverManager.getConnection("jdbc:mysql://localhost:3307/cms_test?serverTimezone=UTC&useSSL=true",
"root", "root");
return con;
}
问题2:beans.xml的配置jdbc时,url后添加参数
Caused by: org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 23 in XML document from class path resource [beans.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 23; columnNumber: 93; 对实体 "useSSL" 的引用必须以 ';' 分隔符结尾。
解决方案:将参数删除。
改为
关注
打赏