org.springframework.boot.config
Class YamlMapFactoryBean

java.lang.Object
  extended by org.springframework.boot.config.YamlProcessor
      extended by org.springframework.boot.config.YamlMapFactoryBean
All Implemented Interfaces:
org.springframework.beans.factory.FactoryBean<Map<String,Object>>

public class YamlMapFactoryBean
extends YamlProcessor
implements org.springframework.beans.factory.FactoryBean<Map<String,Object>>

Factory for Map that reads from a YAML source. 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. If multiple resources are provided the later ones will override entries in the earlier ones hierarchically - that is all entries with the same nested key of type Map at any depth are merged. For example:

 foo:
   bar:
    one: two
 three: four
 
 
plus (later in the list)
 foo:
   bar:
    one: 2
 five: six
 
 
results in an effecive input of
 foo:
   bar:
    one: 2
    three: four
 five: six
 
 
Note that the value of "foo" in the first document is not simply replaced with the value in the second, but its nested values are merged.

Author:
Dave Syer

Nested Class Summary
 
Nested classes/interfaces inherited from class org.springframework.boot.config.YamlProcessor
YamlProcessor.DocumentMatcher, YamlProcessor.MatchCallback, YamlProcessor.MatchStatus, YamlProcessor.ResolutionMethod
 
Constructor Summary
YamlMapFactoryBean()
           
 
Method Summary
 Map<String,Object> getObject()
           
 Class<?> getObjectType()
           
 boolean isSingleton()
           
 void setSingleton(boolean singleton)
          Set if a singleton should be created, or a new object on each request otherwise.
 
Methods inherited from class org.springframework.boot.config.YamlProcessor
process, setDocumentMatchers, setMatchDefault, setResolutionMethod, setResources
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

YamlMapFactoryBean

public YamlMapFactoryBean()
Method Detail

getObject

public Map<String,Object> getObject()
Specified by:
getObject in interface org.springframework.beans.factory.FactoryBean<Map<String,Object>>

getObjectType

public Class<?> getObjectType()
Specified by:
getObjectType in interface org.springframework.beans.factory.FactoryBean<Map<String,Object>>

setSingleton

public void setSingleton(boolean singleton)
Set if a singleton should be created, or a new object on each request otherwise. Default is true (a singleton).


isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface org.springframework.beans.factory.FactoryBean<Map<String,Object>>


Copyright © 2013. All Rights Reserved.