There are compound property names in Spring XML but I can’t find compound property values.
Suppose I have Person getter with the following prototype:
class Person {
Person getFather();
void setFather(Person value);
String getAge();
void setAge(String value);
...
}
The Company prototype is like follows:
class Company {
Person getOwner();
void setOwner(Person value);
...
}
Can I connect these with something like
<bean id="Bob" class="Person"/>
<bean id="Barnyard" class="Company">
<property name="owner" ref="Bob.father"/>
</bean>
Above does not works saying “no bean with Bob.father id”.
The following also does not work
<bean id="Barnyard" class="Company">
<property name="owner" value="Bob.father"/>
</bean>
saying can’t convert String to Person.
How to accomplish?
UPDATE
Suppose I want to set age of company owner. Apparently I should write this:
<bean id="Barnyard" class="Company">
<property name="owner" value="#{Bob.father}"/>
<property name="owner.age" value="38"/>
</bean>
Isn’t this a bad design when I CAN use properties of properties at LEFT but CANNOT do the same at RIGHT??
Spring EL will work here also, even more concise than the question you had previously –