SpringBoot启动报错:PageHelper循环依赖


出现原因

之前的项目是SpringBoot2.1.5,然后升级为2.7.6后,启动项目是报错:The dependencies of some of the beans in the application context form a cycle:

启动时报错


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

Description:

The dependencies of some of the beans in the application context form a cycle:

┌──->──┐
|  com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration
└──<-──┘

Action:

Relying upon circular references is discouraged and they are prohibited by default. Update your application to remove the dependency cycle between beans. As a last resort, it may be possible to break the cycle automatically by setting spring.main.allow-circular-references to true.

解决方案:

升级com.github.pagehelpe为1.4.1版本

        <!-- Mybatis分页插件(升级2.7.x之后,禁止循环依赖) -->
        <dependency>
            <groupId>com.github.pagehelper</groupId>
            <artifactId>pagehelper-spring-boot-starter</artifactId>
            <version>1.4.1</version>
        </dependency>

分类:Java
标签: SpringBoot BUG修复
文章目录