open class YamlPropertiesFactoryBean : YamlProcessor, FactoryBean<Properties>, InitializingBean
Factory for java.util.Properties that reads from a YAML source, exposing a flat structure of String property values.
YAML is a nice human-readable format for configuration, and it has some useful hierarchical properties. It's more or less a superset of JSON, so it has a lot of similar features.
Note: All exposed values are of type String
for access through the common Properties#getProperty
method (e.g. in configuration property resolution through PropertyResourceConfigurer#setProperties(Properties)
). If this is not desirable, use YamlMapFactoryBean instead.
The Properties created by this factory have nested paths for hierarchical objects, so for instance this YAML
environments: dev: url: http://dev.bar.com name: Developer Setup prod: url: http://foo.bar.com name: My Cool App
is transformed into these properties: environments.dev.url=http://dev.bar.com environments.dev.name=Developer Setup environments.prod.url=http://foo.bar.com environments.prod.name=My Cool App
Lists are split as property keys with []
dereferencers, for example this YAML: servers: - dev.bar.com - foo.bar.com
becomes properties like this: servers[0]=dev.bar.com servers[1]=foo.bar.com
Author
Dave Syer
Author
Stephane Nicoll
Author
Juergen Hoeller
Since
4.1
YamlPropertiesFactoryBean()
Factory for java.util.Properties that reads from a YAML source, exposing a flat structure of String property values. YAML is a nice human-readable format for configuration, and it has some useful hierarchical properties. It's more or less a superset of JSON, so it has a lot of similar features. Note: All exposed values are of type The Properties created by this factory have nested paths for hierarchical objects, so for instance this YAML is transformed into these properties: Lists are split as property keys with [] dereferencers, for example this YAML: becomes properties like this:
|
open fun afterPropertiesSet(): Unit |
|
open fun getObject(): Properties |
|
open fun getObjectType(): Class<*> |
|
open fun isSingleton(): Boolean |
|
open fun setSingleton(singleton: Boolean): Unit
Set if a singleton should be created, or a new object on each request otherwise. Default is |