<bean> ***</bean>

这叫做Spring的依赖注入也叫控制反转。bean的id也就是你说的bean的id,通过id找你想要调用的bean

<bean > ***</bean>

<bean > ***</bean>

1、property 属性:<property name=" user"  value="123">  user 你就可以在你的demo2Action中用它了

2、<property name="demo2Action"  ref="demo2Action">

ref不是一个单纯的值,ref那个位置如果你要传字符串那就可以用value代替,如果不是则ref则把你的id为demo2Action的一个bean传过去了,你在demo1Action中就可以使用id为demo2Action对象中的属性了,也就相当于你把demo2Action这个bean对象,在你的demo1Action中new出来了。

相关文章:

  • 2021-07-06
  • 2021-11-07
  • 2021-09-17
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-07-13
  • 2021-11-23
  • 2022-01-01
  • 2021-08-04
  • 2022-12-23
  • 2021-09-25
相关资源
相似解决方案