c**o 发帖数: 186 | 1 问一个class 怎么去call other service(or class).
我电面问题.
我说need create bean mapping for class and service,
and in the class use beanfactory to get the bean of the service, then use
the service.
he said, that is it?
我错了吗?
我做code的时候,就这样呀.
谁能指点下. | g*****g 发帖数: 34805 | 2 Usually you inject the other bean into this bean,
that's probably what he expects.
【在 c**o 的大作中提到】![](/moin_static193/solenoid/img/up.png) : 问一个class 怎么去call other service(or class). : 我电面问题. : 我说need create bean mapping for class and service, : and in the class use beanfactory to get the bean of the service, then use : the service. : he said, that is it? : 我错了吗? : 我做code的时候,就这样呀. : 谁能指点下.
| c**o 发帖数: 186 | 3 faint, I just forgot to mention it.
in bean definition, I can use to inject the bean.
Is that what he want?
【在 g*****g 的大作中提到】![](/moin_static193/solenoid/img/up.png) : Usually you inject the other bean into this bean, : that's probably what he expects.
| g*****g 发帖数: 34805 | 4 That's one way, but more common way is to use setter.
【在 c**o 的大作中提到】![](/moin_static193/solenoid/img/up.png) : faint, I just forgot to mention it. : in bean definition, I can use to inject the bean. : Is that what he want?
| c**o 发帖数: 186 | | t*******e 发帖数: 684 | 6 The guy was testing you the concept of dependency injection. | c**o 发帖数: 186 | 7 I know.But when explain it to him. he just interrupt me to ask me the real
case. Then, I forget the important thing to mention. |
|