To access property placeholder from SpEL expression, the following syntax can be used: #{'${x.y.z}'}
. Hovewer, it can’t solve your problem with elvis operator and default values, because it would throw an exception when ${x.y.z}
cannot be resolved.
But you don’t need SpEL to declare default values for properties:
<context:property-placeholder location="..." properties-ref="defaultValues"/>
<bean id = "defaultValues" class = "org.springframework.beans.factory.config.PropertiesFactoryBean">
<property name="properties">
<props>
<prop key="x.y.z">ZZZ</prop>
</props>
</property>
</bean>
<bean ...>
<property name = "..." value = "${x.y.z}" />
</bean>