dependency injection - Spring injecting one reference bean into another reference bean -
in below spring configuration snippet, injecting reference of "somemanager" bean "someworker" , "somelocal". reference of "somelocal" injected "someworker".
my doubt is possible inject same reference of "somemanager" injected "someworker" bean, here in "somelocal".
problem if inject separately "someworker" , "somelocal" unnecessarily there 2 instances of "somemanager" not required in scenario "somelocal" referred within "someworker"
<bean id="someworker" class="com.test.worker.someworker"> <property name="somemanager" ref="somemanager" /> <property name="somelocal" ref="somelocal"/> <bean id="somelocal" class="com.test.local.somelocal"> <property name="somemanager" ref="somemanager" /> </bean> <bean id="somemanager" class="com.test.manager.somemanager"/>
Comments
Post a Comment