国产 无码 综合区,色欲AV无码国产永久播放,无码天堂亚洲国产AV,国产日韩欧美女同一区二区

SpringBoot中循環(huán)依賴報(bào)錯解決---The dependencies of some of the beans in the application context form a cycle

這篇具有很好參考價(jià)值的文章主要介紹了SpringBoot中循環(huán)依賴報(bào)錯解決---The dependencies of some of the beans in the application context form a cycle。希望對大家有所幫助。如果存在錯誤或未考慮完全的地方,請大家不吝賜教,您也可以點(diǎn)擊"舉報(bào)違法"按鈕提交疑問。

循環(huán)依賴:

循環(huán)依賴就是循環(huán)引用,也就是兩個或則兩個以上的bean互相依賴對方,形成閉環(huán)。比如A類中有B屬性,B類中有A屬性

一、報(bào)錯信息

The dependencies of some of the beans in the application context form a cycle:

SpringBoot中循環(huán)依賴報(bào)錯解決---The dependencies of some of the beans in the application context form a cycle

?二、解決方案

1、修改配置文件

根據(jù)Action中的提示

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.

不鼓勵依賴循環(huán)引用,默認(rèn)情況下禁止循環(huán)引用。更新應(yīng)用程序以刪除 Bean 之間的依賴關(guān)系循環(huán)。作為最后的手段,可以通過將 spring.main.allow-circular-references 設(shè)置為 true 來自動打破循環(huán)。因此可以在yml配置文件中設(shè)置來打破循環(huán)依賴

修改yml

spring:
    main:
        allow-circular-references: true

2、添加注解,延遲加載

這個是網(wǎng)上找到的解決方案,經(jīng)過測試,問題順利解決

由于在循環(huán)依賴中,Spring在初始化的時候不知道先加載哪個bean,因此可以通過使用@Lazy注解,放在其中一個bean上,讓這個bean延遲加載,另一個bean就會先加載,進(jìn)而解決循環(huán)依賴問題

SpringBoot中循環(huán)依賴報(bào)錯解決---The dependencies of some of the beans in the application context form a cycle文章來源地址http://www.zghlxwxcb.cn/news/detail-510689.html

到了這里,關(guān)于SpringBoot中循環(huán)依賴報(bào)錯解決---The dependencies of some of the beans in the application context form a cycle的文章就介紹完了。如果您還想了解更多內(nèi)容,請?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!

本文來自互聯(lián)網(wǎng)用戶投稿,該文觀點(diǎn)僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務(wù),不擁有所有權(quán),不承擔(dān)相關(guān)法律責(zé)任。如若轉(zhuǎn)載,請注明出處: 如若內(nèi)容造成侵權(quán)/違法違規(guī)/事實(shí)不符,請點(diǎn)擊違法舉報(bào)進(jìn)行投訴反饋,一經(jīng)查實(shí),立即刪除!

領(lǐng)支付寶紅包贊助服務(wù)器費(fèi)用

相關(guān)文章

  • SpringBoot 循環(huán)依賴,如何解決?

    循環(huán)依賴是指在Spring Boot 應(yīng)用程序中,兩個或多個類之間存在彼此依賴的情況,形成一個循環(huán)依賴鏈。 在這種情況下,當(dāng)一個類在初始化時需要另一個類的實(shí)例,而另一個類又需要第一個類的實(shí)例時,就會出現(xiàn)循環(huán)依賴問題。這會導(dǎo)致應(yīng)用程序無法正確地初始化和運(yùn)行,因?yàn)?/p>

    2024年02月01日
    瀏覽(18)
  • SpringBoot 三級緩存解決循環(huán)依賴源碼分析

    SpringBoot 三級緩存解決循環(huán)依賴源碼分析

    在 SpringBoot 框架中,如果只存在兩級緩存,那么當(dāng)發(fā)生循環(huán)依賴的時候可能存在異常的對象創(chuàng)建流程如下圖所示: 創(chuàng)建 A 的空白對象 a1 解析填充 A 對象的屬性,發(fā)現(xiàn)依賴的 B 對象未創(chuàng)建,則觸發(fā) B 對象創(chuàng)建 創(chuàng)建 B 對象過程中,填充對象屬性時發(fā)現(xiàn)依賴 A 對象,此時從緩存中

    2024年02月11日
    瀏覽(21)
  • SpringBoot 循環(huán)依賴的癥狀和解決方案

    循環(huán)依賴是指在Spring Boot 應(yīng)用程序中,兩個或多個類之間存在彼此依賴的情況,形成一個循環(huán)依賴鏈。 在這種情況下,當(dāng)一個類在初始化時需要另一個類的實(shí)例,而另一個類又需要第一個類的實(shí)例時,就會出現(xiàn)循環(huán)依賴問題。這會導(dǎo)致應(yīng)用程序無法正確地初始化和運(yùn)行,因?yàn)?/p>

    2024年02月09日
    瀏覽(22)
  • 生產(chǎn)項(xiàng)目中基于springboot項(xiàng)目解決循環(huán)依賴的三種方式

    在生產(chǎn)項(xiàng)目中,可以使用Spring Boot框架來快速開發(fā)Spring應(yīng)用程序。Spring Boot提供了一種方便的方式來創(chuàng)建獨(dú)立的,基于Spring的應(yīng)用程序,并且有著高度的自動化配置和開箱即用的特性。 可以使用@Lazy注解來控制Bean的延遲初始化,同時可以使用AOP切面編程來解決循環(huán)依賴問題。

    2024年02月11日
    瀏覽(22)
  • 【報(bào)錯解決】ERROR: pip‘s dependency resolver does not currently take into account all the packages

    【報(bào)錯解決】ERROR: pip‘s dependency resolver does not currently take into account all the packages

    使用pip安裝 某些包時,報(bào)錯: ERROR: pip’s dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts. spyder 5.1.5 requires pyqt55.13, which is not installed. spyder 5.1.5 requires pyqtwebengine5.13, which is not installed. conda-repo-cli 1.0.4

    2024年02月03日
    瀏覽(36)
  • 解決啟動SpringBoot項(xiàng)目報(bào)錯:Unsatisfied dependency expressed through field ‘baseMapper‘.....問題

    解決啟動SpringBoot項(xiàng)目報(bào)錯:Unsatisfied dependency expressed through field ‘baseMapper‘.....問題

    Unsatisfied dependency expressed through field \\\'baseMapper\\\',XXXMapper包掃描不到 當(dāng)你看到這樣的報(bào)錯,你會怎么解決呢: Unsatisfied dependency expressed through field \\\'baseMapper\\\'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type \\\'com.memory.memoryiconbackend.mapper.Wallpape

    2024年02月08日
    瀏覽(31)
  • Flutter Run 啟動失敗 Could not determine the dependencies of task ‘:app:compileDebugJavaWithJavac‘

    flutter run -------------- 原因build-tools版本與項(xiàng)目的版本不一致 flutter doctor -v [√] Android toolchain - develop for Android devices (Android SDK version 33.0.1) ? ? ? Android SDK at C:UsersAdministratorAppDataLocalAndroidsdk ? ? ? Platform android-33, build-tools 33.0.1 ? ? ? Java binary at: C:Program FilesAndroidAndroi

    2024年02月05日
    瀏覽(27)
  • 解決CitSpace分析新版本web of science文獻(xiàn)報(bào)錯“the timing slicing setting is outside the range of your data”

    解決CitSpace分析新版本web of science文獻(xiàn)報(bào)錯“the timing slicing setting is outside the range of your data”

    新版web of science于2021年7月7日上線,舊版 Web of Science 將同步運(yùn)行到2021年底。現(xiàn)在舊版web of science入口早已關(guān)閉,新本web of science的殘產(chǎn)品中也不在提供舊頁面入口。 近來在使用web of science文獻(xiàn)制作CiteSpace圖譜時發(fā)現(xiàn),web of science導(dǎo)出的文獻(xiàn)數(shù)據(jù)在CiteSpace跑的時候都會出現(xiàn)“th

    2024年02月02日
    瀏覽(29)
  • springboot中Injection of resource dependencies failed

    問題一:無非就是注解的問題,業(yè)務(wù)實(shí)現(xiàn)類加@Service,映射類加@Mapper、啟動類上加上@MapperScan(basePackages = \\\"xxx.xxx\\\")以及@Resouce和@Autowired的使用(IDEA中最好使用@Resouce,倒不是說@Autowired有錯,但是會報(bào)波浪線或者爆紅,雖然不影響運(yùn)行),這類問題沒什么好說的,自己看一下漏

    2024年02月03日
    瀏覽(34)
  • Spring6-IoC(Inversion of Control)控制反轉(zhuǎn)和DI(Dependency Injection)依賴注入,手動實(shí)現(xiàn)IOC

    Java 反射機(jī)制是在運(yùn)行狀態(tài)中,對于任意一個類,都能夠知道這個類的所有屬性和方法;對于任意一個對象,都能夠調(diào)用它的任意方法和屬性;這種動態(tài)獲取信息以及動態(tài)調(diào)用對象方法的功能稱為 Java 語言的 反射機(jī)制 。簡單來說, 反射機(jī)制指的是程序在運(yùn)行時能夠獲取自身

    2024年02月09日
    瀏覽(43)

覺得文章有用就打賞一下文章作者

支付寶掃一掃打賞

博客贊助

微信掃一掃打賞

請作者喝杯咖啡吧~博客贊助

支付寶掃一掃領(lǐng)取紅包,優(yōu)惠每天領(lǐng)

二維碼1

領(lǐng)取紅包

二維碼2

領(lǐng)紅包