我已经读过,默认情况下JSF托管bean本质上是Singleton。 我对此有疑问。如果我有两个Java类A和B,就像这样:
class A {
private B b1;
private B b2;
private B b3;
here getters ans setters
}
class B {
String a;
getters and setters
}
我的JSF faces-config.xml:
<managed-bean>
<managed-bean-name>bean_A</managed-bean-name>
<managed-bean-class>...</managed-bean-class>
<managed-bean-scope>request</managed-bean-scope>
<managed-property>
<property-name>b1</property-name>
<value>#{bean_B}</value>
</managed-property>
<managed-property>
<property-name>b2</property-name>
<value>#{bean_B}</value>
</managed-property>
<managed-property>
<property-name>b3</property-name>
<value>#{bean_B}</value>
</managed-property>
</managed-bean>
<managed-bean>
<managed-bean-name>bean_B</managed-bean-name>
<managed-bean-class>...</managed-bean-class>
<managed-bean-scope>none</managed-bean-scope>
</managed-bean>
那么在A类的上述场景b1,b2和b3中,会引用相同的对象或容器来管理为它们分配三个不同的对象吗?