启动失败了,这是什么原因

星辰an

1 回复15 浏览

来自课程:SpringBoot整合SSM框架

Description: The dependencies of some of the beans in the application context form a cycle: ┌──->──┐ | SSMConfiguration (field private javax.sql.DataSource com.tyb.ssm.config.SSMConfiguration.dataSource) └──<-──┘ 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.

全部回复(1)

  • 老师_J 1 楼

    星辰an同学你好,我是J老师。按照同学你提供的错误提示来看,是在做Spring Bean配置的时候出现了循环依赖问题,但是从目前我们比较新的版本来看Spring解决了 单<-->单,单 <-->多的情况。所以同学你检查一下自己的Spring Bean的作用域是否是prototype或者是request,session或全局session。在这个Bean中是否又引用了其他的作用域为以上情况的Bean,所以导致了循环依赖的异常。如果不是以上情况,那么同学你再检查一下Spring的版本是否是老版本,因为Spring在很多个大版本以前就解决了大多数Bean循环依赖的异常场景。

发表回复

登录后可以回复