パッケージ起動レポートBeanCurrentlyInCreationExceptionソリューション


今日プロジェクトに問題が発生しました.mavenパッケージの時は問題ありません.起動時に報告しました.
org.springframework.beans.factory.BeanCurrentlyInCreationException: Error creating bean with name 'entPayTask': Bean with name 'entPayTask' has been injected into other beans [zhituiIncomeServiceImpl] in its raw version as part of a circular reference, but has eventually been wrapped. This means that said other beans do not use the final version of the bean.

これはSpringコンテナがbeanを作成したときにループリファレンスが発生したときに報告される異常です.
循環参照とは
ループリファレンスは、簡単に言えば、A依存B、B依存C、C依存Aであり、閉ループを形成する.
解決策
エラーメッセージに従って参照beanに@Lazyプロパティを追加します.Springの怠惰なロードはbeanが必要なとき、getBeanが必要なときに作成され、BeanCurrentlyInCreationExceptionは報告されません.