小编pri*_*nha的帖子

不鼓励依赖循环引用,并且默认情况下在 Spring Boot 应用程序中禁止使用循环引用

当我运行 Spring Boot 应用程序时,出现以下错误消息。

\n
Description:\n\nThe dependencies of some of the beans in the application context form a cycle:\n\n\xe2\x94\x8c\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x90\n|  securityConfiguration (field private com.prity.springbootdemo1.service.UserService com.prity.springbootdemo1.config.SecurityConfiguration.userService)\n\xe2\x86\x91     \xe2\x86\x93\n|  userServiceImpl (field private org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder com.prity.springbootdemo1.service.UserServiceImpl.passwordEncoder)\n\xe2\x94\x94\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x80\xe2\x94\x98\n\n\nAction:\n\nRelying 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.\n
Run Code Online (Sandbox Code Playgroud)\n

spring-boot

17
推荐指数
2
解决办法
6万
查看次数

标签 统计

spring-boot ×1