Syntax

The syntax ${[type|]key} used by spring-config is very similar to that of spring's PropertyPlaceholderConfigurer with one obvious difference. Because spring-config allows for more than just simple string substitutions there is an extra optional type part that can be used to indicate more complex objects.

The type part of a place holder can be any value that resolves via a ClassUtils.forName(String className) call. If no type part is specified in a place holder spring-config presumes you're asking for a String. So, for example, ${datasource.url} is the equivalent of ${java.lang.String|datasource.url}.

place holder typeresolved class
"java.lang.String"java.lang.String
"java.util.Set"java.util.Set
"[Ljava.lang.String;" or "java.lang.String[]"java.lang.String[]

As with PropertyPlaceholderConfigurer, it's possible to embed multiple place holders within a value element (e.g. "/${baseDirectory}/${subDirectory}/someFile.txt").

String values can and will be converted by Spring to their destination properties using Spring's built in property editors. If you wanted to set a Double value of a bean to a value retrieved from a configurable source, then let Spring take care of the conversion from the String type to the Double.