We are developping an application which can be customized by overriding some beans.
For instance, we have a bean "myBean" which has two properties A and B
In the customized application, we would like to override this bean as below in order to modify its property BCode:<bean id="myBean"> <property name="A" value="Foo" /> <property name="B" value="Bar" /> </bean>
but we do not want to override its A property so we declare this overriding bean as inheriting from the overriden bean.
Unfortunately, it does not work. It seems that when this new bean is being created, the parent bean is already unavailable.Code:<bean id="myBean" parent="myBean"> <property name="B" value="777" /> </bean>
We have tried to get around this issue by using bean aliases. It seems that is not possible.
We have thought of two other solutions but we don't know how to implement them :
- Add a mechanism to automatically change the name of the overriden bean and the one referred in the parent attribute of the overriding bean.
- Make a copy of the parent bean with different name so that the overriding bean can inherit from this copy
Is there anyone who knows how to achieve those solutions or has an other solution for this problem?
Many thanks for your help