When spring boot test Can not load driver class: com.mysql.cj.jdbc.Driver

Beginner spring boot, first use jdbc access the database. It is worth mentioning that, springboot support mainstream ORM framework, mybatis, hibernate, Spring JDBC. Java learning year, for the first time seen the Spring JDBC. I do not know which is the mainstream of the ORM framework, learning to see the spring boot, I tried a little. Jdbc feel should be simple package next. Packaging efforts possible, hibernate smaller than mybatis. I do not know why with less.

However, according to later write the tutorial finished configuring application.properties, often found error during testing. Finally, a lock error: Can not load driver class: com.mysql.cj.jdbc.Driver. Feeling is no data connection. But I do not know where the problem lies. Search the Internet for a long time. God only to find a big hair springboot integration tutorial problems. The problem still lies in this com.mysql.cj.jdbc.Driver engine. Then check the following specific reasons. God found a large blog.

Portal: https://www.cnblogs.com/qubo520/p/8483595.html

The reason is that roughly jar package version of the problem of mysql-connector-java mysql reference. Because com.mysql.cj.jdbc.Driver engine is in 6+ mysql-connector-java before the reform. 5 and below or com.mysql.jdbc.Driver. This is very embarrassing. To put it plainly, is because the version of the problem, so the engine mysql wrong. Of course not connect.

Online thank the great God who selfless dedication again.

Guess you like

Origin www.cnblogs.com/mxghsy/p/11725845.html