Mybatis-plus @Select annotation pitfalls The method's class, org.apache.ibatis.annotations.Select, is available from

The error message when running is as follows:

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
[threathunting:172.20.1.102:28085] 2022-11-04 15:02:23.912 ERROR 20660 [-] [main] o.s.b.d.LoggingFailureAnalysisReporter   

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    com.baomidou.mybatisplus.core.MybatisMapperAnnotationBuilder$AnnotationWrapper.<init>(MybatisMapperAnnotationBuilder.java:677)

The following method did not exist:

    org.apache.ibatis.annotations.Select.databaseId()Ljava/lang/String;

The method's class, org.apache.ibatis.annotations.Select, is available from the following locations:

    jar:file:/D:/repository/org/mybatis/mybatis/3.5.3/mybatis-3.5.3.jar!/org/apache/ibatis/annotations/Select.class

The class hierarchy was loaded from the following locations:

    org.apache.ibatis.annotations.Select: file:/D:/repository/org/mybatis/mybatis/3.5.3/mybatis-3.5.3.jar


Action:

Correct the classpath of your application so that it contains a single, compatible version of org.apache.ibatis.annotations.Select

Disconnected from the target VM, address: '127.0.0.1:59677', transport: 'socket'

Process finished with exit code 1

 After analyzing the problem, it was found that the select package under mybatis was referenced.

 This package was not found in my maven pom.xml

Use your special move and execute it in the idea terminal window

mvn dependency:tree > a.txt

All maven dependency packages of the project will be generated in the project directory.

 The mybatis jar package was introduced in the pagehelper paging plug-in.

Next, the problem is easily solved. Find the pagehelper dependency in the project and exclude the package mybatis dependency.

        <!--pagehelper-->
        <dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper-spring-boot-starter</artifactId>
            <version>1.2.13</version>
            <exclusions>
                <exclusion>
                    <artifactId>mybatis</artifactId>
                    <groupId>org.mybatis</groupId>
                </exclusion>
            </exclusions>
        </dependency>

 After completing the above operations, restart the project and the startup is successful.

Guess you like

Origin blog.csdn.net/wangguoqing_it/article/details/127689261