在JAVA中注册驱动的时候,使用JDK8版本,会出现上述的问题:加载com.mysql.jdbc.Driver。这是不推荐的。新的驱动程序类是com.mysql.cj.jdbc.Dirver. 驱动程序通过SPI自动注册,通常不需要手动加载驱动程序类。
com.mysql.jdbc.Driver
com.mysql.cj.jdbc.Dirver
言外之意就是把注册类中包名com.mysql.jdbc.Driver改为com.mysql.cj.jdbc.Dirver即可。。
eg:
想看该问题更详细的原理及解决方案: https://blog.csdn.net/weixin_42323802/article/details/82500458