• Post Reply Bookmark Topic Watch Topic
  • New Topic

How to create interdepent beans  RSS feed

 
Khuzema Dharwala
Ranch Hand
Posts: 61
Java Linux Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,


Lets say I have a class A which depends on class B

and similarly class B depends on class A


I want to create bean of class A and class B in Spring, can anyone tell how to do this because both classes are interdependent on each other ?

Regards,
Khuzema
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 37395
531
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Khuzema,
The best approach is to refactor your code to avoid this situation. If you can't, this article lists some good alternatives to work around the circular dependency problem.
 
Khuzema Dharwala
Ranch Hand
Posts: 61
Java Linux Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!