更多>>Java程序設計 Blog
來源:一度好 時間:2022-12-06 閱讀:3540
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>
評論列表 |
暫時沒有相關記錄
|
發表評論