Spring SpEL: how to write ternary operation in XML config? -
in spring xml config, need set value specific property value depending on value of property.
i need this:
<bean id="myid" class="myclass">    <property name="myprop"             value="#{${property_a} == 'test-a' ? ${property_b} : 'anothervalue'}"    />   i want myprop set value of property_b if property_a equal "test-a", otherwise myprop must set "anothervalue".
property_a , property_b both defined in config.properties file.
is possible write such statement in xml spel?
<property name="myprop"         value="#{'${property_a}' == 'test-a' ? '${property_b}' : 'anothervalue' }" />   you have ensure result of properties placeholder resolution still literal. so, that's why must wrap ${...} ''.
Comments
Post a Comment