dependency injection not behaving in spring -
simply have 2 classes. questions.java , answers.java trying inject answers object questions. beans.xml file
<bean id="questions" class="main.questions"> <constructor-arg value="0000"></constructor-arg> <constructor-arg value="what question?"></constructor-arg> <constructor-arg value="threading"></constructor-arg> <property name="correctanswer" value="deadlock"></property> <property name="answers" ref="answers"></property> </bean> <bean id="answers" class="main.answers"> <constructor-arg value="0000"></constructor-arg> <constructor-arg value="livelock"></constructor-arg> </bean>
when output console in netbeans line
question [questionid=0, question=what question?, category=threading, correctanswer=deadlock]
when surely should answers=answers injected it. literally have no idea why wont work.
[solved]. foolish error, forgot put correct stuff in tostring() method. apologies horrible error everyone!
Comments
Post a Comment