<strong id="0i0mg"><samp id="0i0mg"></samp></strong>
<menu id="0i0mg"><tt id="0i0mg"></tt></menu>
  • 更多>>Java程序設計 Blog

    關于 SpringBoot 分頁 pagehelper 啟動時報錯:com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration 的解決方法

    SpringBoot 加入了 PageHelper 分頁依賴后,啟動報錯: The dependencies of some of the beans in the application context form a cycle: com.github.pagehelper.autoconfigure.PageHelperAutoConfiguration

    一、問題


    在 SpringBoot 中,加入了 PageHelper 依賴后,在啟動 SpringBoot 時,報錯如下:

      .   ____          _            __ _ _
     /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
    ( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
     \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
      '  |____| .__|_| |_|_| |_\__, | / / / /
     =========|_|==============|___/=/_/_/_/
     :: Spring Boot ::                (v2.7.6)
    
    
    
    Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
    
    ***************************
    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.
    
    
    Process finished with exit code 1


    二、解決方法

    1、方法一


    在 pom.xml 配置文件中,將 pagehelper-spring-boot-starter 的版本調高一些


    如當前版本為:

    <groupId>com.github.pagehelper</groupId>
    <artifactId>pagehelper-spring-boot-starter</artifactId>
    <version>1.2.12</version>


    修改為:

    <groupId>com.github.pagehelper</groupId>
    <artifactId>pagehelper-spring-boot-starter</artifactId>
    <version>1.4.1</version>


    2、方法二


    在 application.yml 配置文件中,加入如下配置:

    spring:
      main:
        allow-circular-references: true


    3、方法三


    在 pom.xml 配置文件中,將 spring-boot-starter-parent 的版本調低一些


    如當前版本為:

    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.7.6</version>


    修改為:

    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.5.12</version>


    評論列表

    暫時沒有相關記錄

    發表評論

    用來接收審核回復提醒,請認真填寫

      換一張?
    captcha
    看不清?點擊圖片換一張
    色视频免费观看,国外11孩岁女被A片免费观看,偷拍区小说区图片区激情另类,无码啪啪精品一区二区三区99,女人被c到喷水高潮视频,黄色免费在线观看视频