Bootstrap

SpringBoot导入pagehelper后依赖报错问题

我使用了mybatis-plus框架,业务原因,需要用pagehelper分页,导入依赖后报错

        <!--分页-->
        <dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper-spring-boot-starter</artifactId>
            <version>1.2.5</version>
        </dependency>
        <!--集成mybatis-plus3.5.1 start-->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.5.1</version>
        </dependency>

报错信息

***************************
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.extension.plugins.inner.PaginationInnerInterceptor.<clinit>(PaginationInnerInterceptor.java:70)

The following method did not exist:

    net.sf.jsqlparser.schema.Column.withColumnName(Ljava/lang/String;)Lnet/sf/jsqlparser/schema/Column;

The method's class, net.sf.jsqlparser.schema.Column, is available from the following locations:

    jar:file:/Users/meng/.m2/repository/com/github/jsqlparser/jsqlparser/1.0/jsqlparser-1.0.jar!/net/sf/jsqlparser/schema/Column.class

The class hierarchy was loaded from the following locations:

    net.sf.jsqlparser.schema.Column: file:/Users/meng/.m2/repository/com/github/jsqlparser/jsqlparser/1.0/jsqlparser-1.0.jar
    net.sf.jsqlparser.parser.ASTNodeAccessImpl: file:/Users/meng/.m2/repository/com/github/jsqlparser/jsqlparser/1.0/jsqlparser-1.0.jar

Action:

Correct the classpath of your application so that it contains a single, compatible version of net.sf.jsqlparser.schema.Column

Process finished with exit code 1

解决方法

参考https://www.jianshu.com/p/9751824c2d94
排除掉jsqlparser就好了

        <!--分页-->
        <dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper-spring-boot-starter</artifactId>
            <version>1.2.5</version>
              <exclusions>
                <exclusion>
                    <artifactId>mybatis</artifactId>
                    <groupId>org.mybatis</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>mybatis-spring</artifactId>
                    <groupId>org.mybatis</groupId>
                </exclusion>
<!--                <exclusion>
                    <artifactId>mybatis-spring-boot-starter</artifactId>
                    <groupId>org.mybatis.spring.boot</groupId>
                </exclusion>-->
                <exclusion>
                    <artifactId>jsqlparser</artifactId>
                    <groupId>com.github.jsqlparser</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <!--集成mybatis-plus3.5.1 start-->
        <dependency>
            <groupId>com.baomidou</groupId>
            <artifactId>mybatis-plus-boot-starter</artifactId>
            <version>3.5.1</version>
        </dependency>
;