How to prevent Spring Boot from parsing YAML keys with dots -
I have a YAML configuration file with a map of properties:
Properties: ABC: 1 The boot will parse it as:
{A: {B: {c: 1}}} However, what do I need:
{'ABC': 1} Is it anyway to pass key mode? It does not help to quote the key.
Update
Below the actual example.
Java
import static com.google.common.collect.maps.newLinkedHashMap; Import java.util.Map; Import javax.annotation.PostConstruct; Import lombok.Data; Import lombok.val; Import org.springframework.boot.context.properties.ConfigurationProperties; Import org.springframework.context.annotation.configuration; @ Data @ configuration @ configuration properties ("hop") public category HadoopProperties {Private map & lt; Object, object & gt; Properties = NewLinkHashmap (); } YAML
application.yml :
Hadoop: Properties: fs.defaultFS: HDFS: // Local Host: 8020 mapred.job.tracker: Local Host: 8021 Result
Calling ToString () as a result on the object:
HadoopProperties (property = {FS = {defaultFS = HDFS: // local host: 8020}, mapred = {job = {tracker = Local Host: 8021}}}}}
I see it. Because you are bound to a very normal object, so Spring thinks boot that your term separators map key dereferences that you will be connected to a map or property?
Comments
Post a Comment