How does Spring 3 expression language interact with property placeholders?

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” … Read more

How to fill HashMap from java property file with Spring @Value

You can use the SPEL json-like syntax to write a simple map or a map of list in property file. simple.map={‘KEY1’: ‘value1’, ‘KEY2’: ‘value3’, ‘KEY3’: ‘value5’} map.of.list={\ ‘KEY1’: {‘value1′,’value2’}, \ ‘KEY2’: {‘value3′,’value4’}, \ ‘KEY3’: {‘value5’} \ } I used \ for multiline property to enhance readability Then, in Java, you can access and parse it … Read more