为了测试类不会打包, 将测试类放到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" 的引用必须以 ';' 分隔符结尾。
解决方案:将参数删除。
改为
关注
打赏
最近更新
- 深拷贝和浅拷贝的区别(重点)
- 【Vue】走进Vue框架世界
- 【云服务器】项目部署—搭建网站—vue电商后台管理系统
- 【React介绍】 一文带你深入React
- 【React】React组件实例的三大属性之state,props,refs(你学废了吗)
- 【脚手架VueCLI】从零开始,创建一个VUE项目
- 【React】深入理解React组件生命周期----图文详解(含代码)
- 【React】DOM的Diffing算法是什么?以及DOM中key的作用----经典面试题
- 【React】1_使用React脚手架创建项目步骤--------详解(含项目结构说明)
- 【React】2_如何使用react脚手架写一个简单的页面?