2
在我的Spring XML配置中,我需要根据另一个属性的值将值设置为特定的属性值。Spring SpEL:如何在XML配置中编写三元操作?
我需要的是这样的:
<bean id="myid" class="myclass">
<property name="myprop"
value="#{${property_a} == 'test-a' ? ${property_b} : 'anothervalue'}"
/>
我想myprop
要设置的property_b
如果property_a
等于“测试一”的值,否则myprop
必须设置为“anothervalue”。
property_a
和property_b
都在我的config.properties
文件中定义。
是否有可能在XML SpEL中编写这样的语句?