报错:
java.lang.ClassCastException: class com.mysql.cj.jdbc.ConnectionImpl cannot be cast to class com.sun.jdi.connect.spi.Connection
(com.mysql.cj.jdbc.ConnectionImpl is in unnamed module of loader 'app';
com.sun.jdi.connect.spi.Connection is in module jdk.jdi of loader 'app')
原因:导错包
解决方法:
将 import com.sun.jdi.connect.spi.Connection;
改成 import java.sql.Connection;