Spring circle reference resolution | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
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 Resposta
+ 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