Springboot error "Error creating bean with name" and "Loading class `com.mysql.jdbc.Driver'" solution

Record the errors that occur when using springBoot:
The first error: Error creating bean with name 'userMapper'
The reason for the error is to check the correctness of dependencies: Make sure that the implementation class of 'userMapper' (such as 'UserMapper') has been correctly defined , and associate it with the corresponding bean in the configuration file. Also make sure that the classpath of dependencies is correct and that all relevant libraries and dependencies have been properly brought into the project.
But I later found out that the version of the dependency I used was too low. I changed to a higher version to solve this problem. The dependencies added in the xml are as follows:

<dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.5.3.1</version>
        </dependency>
        <dependency>
            <groupId>org.mybatis.spring.boot</groupId>
            <artifactId>mybatis-spring-boot-starter-test</artifactId>
            <version>3.0.1</version>
            <scope>test</scope>
        </dependency>

The second error: Loading class `com.mysql.jdbc.Driver'. This is deprecated.
Simply put, the grammar of this dependency is not written in this way, so I changed the wording in the application to " com.mysql .cj.jdbc.Drive r", so the problem is solved.

Summary: First, be good at using Baidu translation; second, you must be careful, in fact, springboot is still very smart.

Guess you like

Origin blog.csdn.net/weixin_43148375/article/details/131728629