开发者

Spring: problem with setter Dependence Injection

开发者 https://www.devze.com 2023-04-04 02:21 出处:网络
I have the following situation: I set the beans (in applicationContext.xml) as follows: ... <bean id=\"bDaoImpl\" cl开发者_如何学Cass=\"BDaoImpl\"></bean>

I have the following situation:

Spring: problem with setter Dependence Injection

I set the beans (in applicationContext.xml) as follows:

...
<bean id="bDaoImpl" cl开发者_如何学Cass="BDaoImpl"></bean>
<bean id="injBInA" class="ADaoImpl">
   <property name="b" ref="bDaoImpl"/>
</bean>
...

Why when I use "b" in the value of the Object class ADaoImpl is null?


I have the solution. Sorry. Basically when I load the bean from application context (ApplicationContext.getBean) does not load the bean with id = "injBInA" therefore right was never carried out the injection

0

精彩评论

暂无评论...
验证码 换一张
取 消