更多>>Java程序设计 Blog
来源:一度好 时间:2022-12-06 阅读:6548
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>
评论列表 |
暂时没有相关记录
|
发表评论