Relative references in expressions in XML bean definitions in Spring 3.0

This is an example from the spring 3.0 reference:

<bean id="numberGuess" class="org.spring.samples.NumberGuess">
    <property name="randomNumber" value="#{ T(java.lang.Math).random() * 100.0 }"/>
</bean>

<bean id="shapeGuess" class="org.spring.samples.ShapeGuess">
    <property name="initialShapeSeed" value="#{ numberGuess.randomNumber }"/>
</bean>

But what I intend to do is something like this:

<bean id="foo" class="com.example.Foo">
    <property name="name" value="myName"/>
    <property name="prop">
        <bean class="com.example.Bar">
            <property name="#{ parent.name }" />
        </bean>
    </property>
</bean>

Thus, the property name of the internal bean is populated with the name of the external bean. Is this possible with spring expression language? What would be the expression for something like this (the parent obviously doesn't work ^^)?

+3
source share
1 answer

I do not think this is possible in this milestone. However, they still fulfill function requests for RC1, so I suggest submitting an application.

+1
source

Source: https://habr.com/ru/post/1713962/


All Articles