Spring circle reference resolution | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Spring circle reference resolution

Quite strange for me... I am a newer in Spring, and still didn’t use to it’s “think for us” logic 😅 How can we solve a problem with two beans that inject each other in configuration .xml file? The compiler prints an error of “circle reference”, meaning that the other bean is still “under construction”? Doesn’t happen in “classy” java api 🙈

5th Sep 2018, 12:21 PM
Nina
Nina - avatar
1 Answer
+ 1
It can be fixed by using setter injection. We can also use @Lazy at constructor injection point
9th May 2020, 10:47 AM
Lijo M Loyid
Lijo M Loyid - avatar