Tag Archives: [framework] mybatis

[Solved] Cannot find class: com.mysql.jdbc.Driver

When using mybatis to write the entry instance for the first time, I encountered the error of cannot find class: com.mysql.jdbc.driver database property configuration file content:

jdbc.driver=com.mysql.cj.jdbc.Driver
jdbc.url=jdbc:mysql://localhost:3306/exercise?serverTimezone=GMT%2B8
jdbc.user=root
jdbc.password=1996mysqlyue

Mybatis configuration part:

            <!--Four basic information for connecting to the database-->
            <dataSource type="POOLED">
                <property name="driver" value="${jdbc.driver}"/>
                <property name="url" value="${jdbc.url}"/>
                <property name="username" value="${jdbc.user}"/>
                <property name="password" value="${jdbc.password}"/>
            </dataSource>

Confirm that there is no space in the quotation marks of the value value in the configuration file, and there is no space in the configuration information of the database property file, but still report an error
subsequent solution:
modified the dependency version of MySQL connector introduced by Maven.