useSSL and allowPublicKeyRetrieval are two parameters, requiring &

I was testing UserTest and there were some breakpoints
package Test;
import com.itheima.pojo.User;
import org.apache.ibatis.io.Resources;
import org.apache.ibatis.session.SqlSession;
import org.apache.ibatis.session.SqlSessionFactory;
import org.apache.ibatis.session.SqlSessionFactoryBuilder;
import org.junit.Test;
import java.io.IOException;
import java.io.Reader;
public class UserTest { //这个地方测试错误!
@Test
public void userFindByIdTest() { //这个地方测试错误!
String resources = "mybatis-config.xml";
//创建流
Reader reader = null;
try {
//读取 mybatis-config.xml文件内容到reader对象中
reader = Resources.getResourceAsReader(resources);
} catch (IOException e) {
e.printStackTrace();
}
//初始化MyBatis数据库,创建SqlSessionFactory类的实例
SqlSessionFactory sqlMapper = new
SqlSessionFactoryBuilder().build(reader);
//创建SqlSession实例
SqlSession session = sqlMapper.openSession();
//传入参数查询,返回结果
User user = session.selectOne(
"findById", 1);
//输出结果
System.out.println(user.getUname());
//关闭session
session.close();
}
}
This is the original image
Problems occur
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.sql.SQLNonTransientConnectionException: Cannot load connection class because of underlying exception: com.mysql.cj.exceptions.WrongArgumentException: Malformed database URL, failed to parse the connection string near '=true '.
### The error may exist in com/itheima/mapper/UserMapper.xml
### The error may involve com.itheima.mapper.UserMapper.findById
### The error occurred while executing a query
### Cause: java.sql.SQLNonTransientConnectionException: Cannot load connection class because of underlying exception: com.mysql.cj.exceptions.WrongArgumentException: Malformed database URL, failed to parse the connection string near '=true '.
I checked other files, didn't burst red, asked someone, she said my first question
Public Key Retrieval is not allowed
Then I added allowPublicKeyRetrieval=true
to db.propertiesmysql.driver=com.mysql.cj.jdbc.Driver
mysql.url=jdbc:mysql://localhost:3306/mybatis?serverTimezone=UTC&\
characterEncoding=utf8&useUnicode=true&useSSL=false allowPublicKeyRetrieval=true
mysql.username=root
mysql.password=root
But a new problem arises
org.apache.ibatis.exceptions.PersistenceException:
### Error querying database. Cause: java.sql.SQLNonTransientConnectionException: Cannot load connection class because of underlying exception: com.mysql.cj.exceptions.WrongArgumentException: Malformed database URL, failed to parse the connection string near '=true '.
0 Answer
这家伙很懒,什么都没留下...