if I inject a recursive dependency through a constructor, then it gives me an exception, while if I use setter it doesn’t. Why is this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Do you mean that A has a B, and B has an A, and you’re trying to inject them both into each other? Logically, the behavior you describe makes sense.
looks fine, but what should this look like?
No matter how you rewrite the second group, you can’t create an A that depends on B by use of constructor.