package de.springbootbuch.extconfig;

import java.net.URL;
import java.util.List;
import java.util.Map;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Component
@ConfigurationProperties("example")
public class ExampleConfiguration {
    public static class Server {
        /** The name of the server. */
        private String name;
        
        /** The URL of the server. */
        private URL url;

        public String getName() {
            return name;
        }

        public void setName(String name) {
            this.name = name;
        }

        public URL getUrl() {
            return url;
        }

        public void setUrl(URL url) {
            this.url = url;
        }              

        @Override
        public String toString() {
            return "Server{" + "name=" + name + ", url=" + url + '}';
        }
    }
    
    public static enum Environment {
        dev, prod, cloud
    }
    
    /** The greeting used. */
    private String greeting;
    
    /** Some arbitrary interval. */
    private Integer interval;
    
    /** An example of maps. */
    private Map<Environment, Map<String, Object>> environments;
    
    /** The list of servers. */
    private List<Server> servers;
    
    /** A precision. */
    private Double precision;

    public String getGreeting() {
        return greeting;
    }

    public void setGreeting(String greeting) {
        this.greeting = greeting;
    }

    public Integer getInterval() {
        return interval;
    }

    public void setInterval(Integer interval) {
        this.interval = interval;
    }

    public Map<Environment, Map<String, Object>> getEnvironments() {
        return environments;
    }

    public void setEnvironments(Map<Environment, Map<String, Object>> environments) {
        this.environments = environments;
    }

    public List<Server> getServers() {
        return servers;
    }

    public void setServers(List<Server> servers) {
        this.servers = servers;
    }

    public Double getPrecision() {
        return precision;
    }

    public void setPrecision(Double precision) {
        this.precision = precision;
    }

    @Override
    public String toString() {
        final StringBuilder rv = new StringBuilder();        
        rv
                .append("ExampleConfiguration{")
                .append("\n\tgreeting=").append(greeting)
                .append(",\n\tinterval=").append(interval)
                .append(",\n\tprecision=").append(precision)
                .append(",\n\tservers=").append(servers)                
                .append(",\n\tenvironments=").append(environments)
                .append("\n}");
        return rv.toString();
    }
    
    
}
@@ -407,25 +407,17 @@
 g name;%0A
-        
 %0A
+
         
@@ -766,30 +766,16 @@
        %7D
-              
 %0A%0A      
@@ -903,29 +903,25 @@
     %7D%0A    %7D%0A
-    
 %0A
+
     public s
@@ -972,29 +972,25 @@
 cloud%0A    %7D%0A
-    
 %0A
+
     /** The 
@@ -1036,21 +1036,17 @@
 eeting;%0A
-    
 %0A
+
     /** 
@@ -1103,21 +1103,17 @@
 terval;%0A
-    
 %0A
+
     /** 
@@ -1199,21 +1199,17 @@
 nments;%0A
-    
 %0A
+
     /** 
@@ -1266,21 +1266,17 @@
 ervers;%0A
-    
 %0A
+
     /** 
@@ -2290,24 +2290,16 @@
 ilder();
-        
 %0A       
@@ -2585,32 +2585,16 @@
 servers)
-                
 %0A       
@@ -2725,15 +2725,7 @@
   %7D%0A
-    %0A    
+%0A
 %0A%7D

Trim trailing spaces