{"id":71572,"date":"2017-12-20T10:00:36","date_gmt":"2017-12-20T08:00:36","guid":{"rendered":"https:\/\/www.javacodegeeks.com\/?p=71572"},"modified":"2017-12-19T10:39:31","modified_gmt":"2017-12-19T08:39:31","slug":"intro-spring-cloud-config-server","status":"publish","type":"post","link":"https:\/\/www.javacodegeeks.com\/2017\/12\/intro-spring-cloud-config-server.html","title":{"rendered":"Intro to Spring Cloud Config Server"},"content":{"rendered":"<h2>1. Overview<\/h2>\n<p>In this tutorial, we will review the basics of <strong>Spring Cloud Config Server<\/strong>. We will setup a <strong>Config Server<\/strong> and then build a <strong>client application<\/strong> that <strong>consumes the configuration<\/strong> on startup and then\u00a0refreshes\u00a0the configuration without restarting. The application we are building is the same \u201cHello World\u201d application discussed in the <a href=\"https:\/\/spring.io\/guides\/gs\/centralized-configuration\/\" rel=\"noopener\">Centralized Configuration Getting Started Guide<\/a>, but we go into more depth about the concepts of Spring Cloud Config Server in this article.<\/p>\n<p>The full source code for the tutorial is on <a href=\"https:\/\/github.com\/michaelcgood\/michaelcgood-spring-cloud-config-server\" target=\"_blank\" rel=\"noopener\">Github<\/a>.<\/p>\n<h2>2. What is Spring Cloud Config Server?<\/h2>\n<p>As the <a href=\"https:\/\/cloud.spring.io\/spring-cloud-config\/single\/spring-cloud-config.html\" rel=\"noopener\">documentation<\/a> succinctly states, \u201cSpring Cloud Config provides server and client-side support for externalized configuration in a distributed system.\u201d\u00a0The default implementation of the server storage backend uses <strong>git<\/strong>,\u00a0so it supports labelled versions of configuration environments with ease and is accessible to many tools for managing the content.<\/p>\n<p>Spring Cloud Config <strong>fits very well into Spring applications<\/strong> because its concepts of both client and server map precisely to the Spring <em>Environment<\/em>\u00a0and <em>PropertySource<\/em>\u00a0abstractions. However, Spring Cloud Config can be used with any application running in any language.<\/p>\n<h2>3. Create a Multi Module Project<\/h2>\n<p>The application we are creating will have two modules: one for the Configuration Service and the other for the Configuration client. Because of this, we need to create a parent <em>pom<\/em>.<\/p>\n<h3>3.1 Parent<\/h3>\n<p>In our IDE, let\u2019s create a new project. I\u2019m using Spring Tool Suite, but that\u2019s just a personal preference.<\/p>\n<p>In our\u00a0<em>pom.xml<\/em>, let\u2019s specify our two modules:<\/p>\n<pre class=\"brush:xml\">&lt;?xml version=\"1.0\" encoding=\"UTF-8\"?&gt;\r\n&lt;project xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\" xsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\"&gt;\r\n\t&lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\r\n\r\n\t&lt;groupId&gt;com.michaelcgood&lt;\/groupId&gt;\r\n\t&lt;artifactId&gt;com.michaelcgood&lt;\/artifactId&gt;\r\n\t&lt;version&gt;0.0.1&lt;\/version&gt;\r\n\t&lt;packaging&gt;pom&lt;\/packaging&gt;\r\n\r\n\t&lt;name&gt;michaelcgood-spring-cloud-config-server&lt;\/name&gt;\r\n\t&lt;description&gt;Intro to Spring Cloud Config Server&lt;\/description&gt;\r\n\r\n\r\n    &lt;modules&gt;\r\n        &lt;module&gt;mcg-configuration-client&lt;\/module&gt;\r\n        &lt;module&gt;mcg-configuration-service&lt;\/module&gt;\r\n    &lt;\/modules&gt;\r\n\r\n&lt;\/project&gt;<\/pre>\n<h3>3.2 Configuration Service<\/h3>\n<p>In our IDE, let\u2019s create a new Maven module for our configuration service and insert this in our <em>pom<\/em>:<\/p>\n<pre class=\"brush:xml\">&lt;?xml version=\"1.0\"?&gt;\r\n&lt;project xsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\" xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"&gt;\r\n  &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\r\n  &lt;groupId&gt;com.michaelcgood&lt;\/groupId&gt;\r\n  &lt;artifactId&gt;mcg-configuration-service&lt;\/artifactId&gt;\r\n  &lt;version&gt;0.0.1&lt;\/version&gt;\r\n  &lt;packaging&gt;jar&lt;\/packaging&gt;\r\n  &lt;name&gt;mcg-configuration-service&lt;\/name&gt;\r\n \r\n    &lt;parent&gt;\r\n        &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n        &lt;artifactId&gt;spring-boot-starter-parent&lt;\/artifactId&gt;\r\n        &lt;version&gt;1.5.9.RELEASE&lt;\/version&gt;\r\n        &lt;relativePath \/&gt; &lt;!-- lookup parent from repository --&gt;\r\n    &lt;\/parent&gt;\r\n\r\n    &lt;properties&gt;\r\n        &lt;project.build.sourceEncoding&gt;UTF-8&lt;\/project.build.sourceEncoding&gt;\r\n        &lt;java.version&gt;1.8&lt;\/java.version&gt;\r\n    &lt;\/properties&gt;\r\n\r\n    &lt;dependencies&gt;\r\n        &lt;dependency&gt;\r\n            &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;\r\n            &lt;artifactId&gt;spring-cloud-config-server&lt;\/artifactId&gt;\r\n        &lt;\/dependency&gt;\r\n\r\n        &lt;dependency&gt;\r\n            &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n            &lt;artifactId&gt;spring-boot-starter-test&lt;\/artifactId&gt;\r\n            &lt;scope&gt;test&lt;\/scope&gt;\r\n        &lt;\/dependency&gt;\r\n    &lt;\/dependencies&gt;\r\n\r\n    &lt;dependencyManagement&gt;\r\n        &lt;dependencies&gt;\r\n            &lt;dependency&gt;\r\n                &lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;\r\n                &lt;artifactId&gt;spring-cloud-dependencies&lt;\/artifactId&gt;\r\n                &lt;version&gt;Edgware.RELEASE&lt;\/version&gt;\r\n                &lt;type&gt;pom&lt;\/type&gt;\r\n                &lt;scope&gt;import&lt;\/scope&gt;\r\n            &lt;\/dependency&gt;\r\n        &lt;\/dependencies&gt;\r\n    &lt;\/dependencyManagement&gt;\r\n\r\n    &lt;build&gt;\r\n        &lt;plugins&gt;\r\n            &lt;plugin&gt;\r\n                &lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n                &lt;artifactId&gt;spring-boot-maven-plugin&lt;\/artifactId&gt;\r\n            &lt;\/plugin&gt;\r\n        &lt;\/plugins&gt;\r\n    &lt;\/build&gt;\r\n&lt;\/project&gt;<\/pre>\n<h3>3.3 Configuration Client<\/h3>\n<p>Now we just need to make a module for our configuration client. So, let\u2019s make another Maven module and insert this into our <em>pom<\/em>:<div style=\"display:inline-block; margin: 15px 0;\"> <div id=\"adngin-JavaCodeGeeks_incontent_video-0\" style=\"display:inline-block;\"><\/div> <\/div><\/p>\n<pre class=\"brush:xml\">&lt;?xml version=\"1.0\"?&gt;\r\n&lt;project xsi:schemaLocation=\"http:\/\/maven.apache.org\/POM\/4.0.0 http:\/\/maven.apache.org\/xsd\/maven-4.0.0.xsd\" xmlns=\"http:\/\/maven.apache.org\/POM\/4.0.0\" xmlns:xsi=\"http:\/\/www.w3.org\/2001\/XMLSchema-instance\"&gt;\r\n  &lt;modelVersion&gt;4.0.0&lt;\/modelVersion&gt;\r\n  &lt;groupId&gt;com.michaelcgood&lt;\/groupId&gt;\r\n  &lt;artifactId&gt;mcg-configuration-client&lt;\/artifactId&gt;\r\n  &lt;version&gt;0.0.1&lt;\/version&gt;\r\n  &lt;packaging&gt;jar&lt;\/packaging&gt;\r\n  \t&lt;parent&gt;\r\n\t\t&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n\t\t&lt;artifactId&gt;spring-boot-starter-parent&lt;\/artifactId&gt;\r\n\t\t&lt;version&gt;1.5.9.RELEASE&lt;\/version&gt;\r\n\t\t&lt;relativePath\/&gt; &lt;!-- lookup parent from repository --&gt;\r\n\t&lt;\/parent&gt;\r\n\r\n\t&lt;properties&gt;\r\n\t\t&lt;project.build.sourceEncoding&gt;UTF-8&lt;\/project.build.sourceEncoding&gt;\r\n\t\t&lt;java.version&gt;1.8&lt;\/java.version&gt;\r\n\t&lt;\/properties&gt;\r\n\r\n\t&lt;dependencies&gt;\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;spring-cloud-starter-config&lt;\/artifactId&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;spring-boot-starter-actuator&lt;\/artifactId&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;spring-boot-starter-web&lt;\/artifactId&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\t\t&lt;dependency&gt;\r\n\t\t\t&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n\t\t\t&lt;artifactId&gt;spring-boot-starter-test&lt;\/artifactId&gt;\r\n\t\t\t&lt;scope&gt;test&lt;\/scope&gt;\r\n\t\t&lt;\/dependency&gt;\r\n\t&lt;\/dependencies&gt;\r\n\r\n\t&lt;dependencyManagement&gt;\r\n\t\t&lt;dependencies&gt;\r\n\t\t\t&lt;dependency&gt;\r\n\t\t\t\t&lt;groupId&gt;org.springframework.cloud&lt;\/groupId&gt;\r\n\t\t\t\t&lt;artifactId&gt;spring-cloud-dependencies&lt;\/artifactId&gt;\r\n\t\t\t\t&lt;version&gt;Edgware.RELEASE&lt;\/version&gt;\r\n\t\t\t\t&lt;type&gt;pom&lt;\/type&gt;\r\n\t\t\t\t&lt;scope&gt;import&lt;\/scope&gt;\r\n\t\t\t&lt;\/dependency&gt;\r\n\t\t&lt;\/dependencies&gt;\r\n\t&lt;\/dependencyManagement&gt;\r\n\r\n\t&lt;build&gt;\r\n\t\t&lt;plugins&gt;\r\n\t\t\t&lt;plugin&gt;\r\n\t\t\t\t&lt;groupId&gt;org.springframework.boot&lt;\/groupId&gt;\r\n\t\t\t\t&lt;artifactId&gt;spring-boot-maven-plugin&lt;\/artifactId&gt;\r\n\t\t\t&lt;\/plugin&gt;\r\n\t\t&lt;\/plugins&gt;\r\n\t&lt;\/build&gt;\r\n&lt;\/project&gt;<\/pre>\n<p>Our project structure looks like this now:<br \/>\n<a href=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/spring-cloud-config-project-structure.png\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-71585\" src=\"http:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/spring-cloud-config-project-structure.png\" alt=\"\" width=\"448\" height=\"241\" srcset=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/spring-cloud-config-project-structure.png 448w, https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2017\/12\/spring-cloud-config-project-structure-300x160.png 300w\" sizes=\"(max-width: 448px) 100vw, 448px\" \/><\/a><\/p>\n<h2>4. Config Server<\/h2>\n<p>Now we will create a <strong>Config Servic<\/strong>e to act as an intermediary between our client and a <strong>git repository<\/strong>.<\/p>\n<h3>4.1 Enable Config Server<\/h3>\n<p>We use Spring Cloud\u2019s <em>@EnableConfigServer<\/em> to create a config server that can be communicated with. So, this is just a normal <strong>Spring Boot application with one annotation added to enable the Config Server<\/strong>.:<\/p>\n<pre class=\"brush:java\">@EnableConfigServer\r\n@SpringBootApplication\r\npublic class ConfigServiceApplication {\r\n    \r\n    public static void main(String[] args) {\r\n        SpringApplication.run(ConfigServiceApplication.class, args);\r\n    }\r\n}<\/pre>\n<h3>4.2 application.properties<\/h3>\n<p>To ensure that there is no conflict between ports for our Config Service and client, we specify a different port for the Config Service:<\/p>\n<pre class=\"brush:java\">server.port=8888\r\n\r\nspring.cloud.config.server.git.uri=${HOME}\/Desktop\/mcg-config<\/pre>\n<p>The second line <em>spring.cloud.config.server.git.uri=${HOME}\/Desktop\/mcg-config<\/em> points to a git repository, which we will create next.<\/p>\n<h3>4.3 Git<\/h3>\n<p>On a *nix system, we can do everything on the command line.<br \/>\nWe make a folder on our desktop:<\/p>\n<pre class=\"brush:bash\">mkdir mcg-config<\/pre>\n<p>We create a file named <em>a-bootiful-client.properties<\/em> using <a href=\"http:\/\/www.vim.org\/\" target=\"_blank\" rel=\"noopener\">vim<\/a>:<\/p>\n<pre class=\"brush:bash\">vim a-bootiful-client.properties<\/pre>\n<p>We add the message, \u201cHello World\u201d but this could be whatever we would like. After we write (:w) we quit (:q) vim.<\/p>\n<p>Now let\u2019s create a new repo:<\/p>\n<pre class=\"brush:bash\">git init<\/pre>\n<p>Now we add the file that contains our message:<\/p>\n<pre class=\"brush:bash\">git add a-bootiful-client.properties<\/pre>\n<p>Let\u2019s commit:<\/p>\n<pre class=\"brush:bash\">git commit<\/pre>\n<h2>\u00a05. Configuration Client<\/h2>\n<p>Now let\u2019s create a new Spring Boot application that uses the Config Server to load its own configuration and that refreshes its configuration to reflect changes to the Config Server on-demand, without restarting the JVM.<\/p>\n<p>Spring will see the configuration property files just like it would any property file loaded from <em>application.properties<\/em>, <em>application.yml<\/em> or any other <em>PropertySource<\/em>.<\/p>\n<h3>5.1 Reflecting Changes<\/h3>\n<p>The client may access any value in the Config Server using the standard Spring ways, such as <em>@ConfigurationProperties<\/em> or <em>@Value(\u201c${\u2026\u200b}\u201d)<\/em>.<\/p>\n<p>With this in mind, we create a REST controller that returns the resolved message property\u2019s value:<\/p>\n<pre class=\"brush:java\">@SpringBootApplication\r\npublic class ConfigClientApplication {\r\n\r\n    public static void main(String[] args) {\r\n        SpringApplication.run(ConfigClientApplication.class, args);\r\n    }\r\n}\r\n\r\n@RefreshScope\r\n@RestController\r\nclass MessageRestController {\r\n\r\n    @Value(\"${message:Hello default}\")\r\n    private String message;\r\n\r\n    @RequestMapping(\"\/message\")\r\n    String getMessage() {\r\n        return this.message;\r\n    }\r\n}<\/pre>\n<p>The default configuration only allows the values to be read on the client\u2019s startup and not again. So, using <em>@RefreshScope<\/em> we force the bean to refresh its configuration, which means it will pull updated values from the Config Server, and then trigger a refresh event.<\/p>\n<h3>5.2 bootstrap.properties<\/h3>\n<p>The properties to configure the Config Client must be read in before the rest of the application\u2019s configuration is read from the Config Server, during the bootstrap phase.<\/p>\n<p>We specify the client\u2019s <em>spring.application.name<\/em> and the location of the Config Server <em>spring.cloud.config.uri<\/em>:<\/p>\n<pre class=\"brush:java\">spring.application.name=a-bootiful-client\r\nspring.cloud.config.uri=http:\/\/localhost:8888\r\nmanagement.security.enabled=false<\/pre>\n<p><strong>Notice:<\/strong><br \/>\nWe disabled security with our setting <em>management.security.enabled=false<\/em> to make testing and tinkering easy for us.<\/p>\n<h2>6. Demo<\/h2>\n<p>First we need to change directory to our configuration service and start it:<\/p>\n<pre class=\"brush:bash\">mcg-configuration-service mike$  mvn spring-boot:run<\/pre>\n<p>And then do the same for our client:<\/p>\n<pre class=\"brush:bash\">mcg-configuration-client mike$  mvn spring-boot:run<\/pre>\n<p>We can see in our terminal for configuration service when the <em>a-bootiful-client.properties<\/em> is added:<\/p>\n<pre class=\"brush:bash\">INFO 5921 --- [nio-8888-exec-1] o.s.c.c.s.e.NativeEnvironmentRepository  : Adding property source: file:\/var\/folders\/dk\/48l9cm2x3vnfl5ymh6dtxpwc0000gn\/T\/config-repo-7195892194658362240\/a-bootiful-client.properties<\/pre>\n<p>Let\u2019s open our browser and visit <em>http:\/\/localhost:8080\/message<\/em>. We see \u201cHello World\u201d.<\/p>\n<p>Now let\u2019s change the message in <em>a-bootiful-client.properties<\/em> again and this time put, \u201cHi! :-)\u201d.<\/p>\n<p>After saving and doing a commit, we visit <em>http:\/\/localhost:8888\/a-bootiful-client\/default<\/em> to confirm our change.<\/p>\n<p>Now we invoke the Spring Boot Actuator refersh endpoint to refresh our client:<\/p>\n<pre class=\"brush:bash\">curl -X POST http:\/\/localhost:8080\/refresh<\/pre>\n<p>We visit <em>http:\/\/localhost:8080\/message <\/em>and see our message \u201cHi! :-)\u201d is displayed.<\/p>\n<p>For more information on Spring Boot Actuator, see the tutorial <a href=\"https:\/\/www.javacodegeeks.com\/2017\/10\/building-spring-boot-restful-service-spring-boot-actuator.html\" target=\"_blank\" rel=\"noopener\">Building Spring Boot RESTful Service + Spring Boot Actuator<\/a>.<\/p>\n<h2>7. Conclusion<\/h2>\n<p>We just completed centralizing configuration of our services in Spring. We accomplished this by standing up a Spring Cloud Config Server and creating a client to consume the configuration on startup and then refresh the configuration without restarting.<\/p>\n<p>Many other things can be done with Spring Cloud Config Server that we did not touch on, such as:<\/p>\n<ul>\n<li>Have the Config Server register with the Discovery Service for Spring Cloud Netflix, Eureka Service Discovery or Spring Cloud Consul<\/li>\n<li>Serve configuration in YAML or Properties format<\/li>\n<li>Serve plain text configuration files<\/li>\n<li>Embed the config server in an application<\/li>\n<\/ul>\n<p>The full source code can be found on <a href=\"https:\/\/github.com\/michaelcgood\/michaelcgood-spring-cloud-config-server\" target=\"_blank\" rel=\"noopener\">Github<\/a>.<\/p>\n<div class=\"attribution\">\n<table>\n<tbody>\n<tr>\n<td>Published on Java Code Geeks with permission by Michael Good, partner at our <a href=\"http:\/\/www.javacodegeeks.com\/join-us\/jcg\/\" target=\"_blank\" rel=\"noopener\">JCG program<\/a>. See the original article here: <a href=\"http:\/\/michaelcgood.com\/spring-cloud-config-server\/\" target=\"_blank\" rel=\"noopener\">Intro to Spring Cloud Config Server<\/a><\/p>\n<p>Opinions expressed by Java Code Geeks contributors are their own.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>1. Overview In this tutorial, we will review the basics of Spring Cloud Config Server. We will setup a Config Server and then build a client application that consumes the configuration on startup and then\u00a0refreshes\u00a0the configuration without restarting. The application we are building is the same \u201cHello World\u201d application discussed in the Centralized Configuration Getting &hellip;<\/p>\n","protected":false},"author":5558,"featured_media":112,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[992],"class_list":["post-71572","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-enterprise-java","tag-spring-cloud"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Intro to Spring Cloud Config Server - Java Code Geeks<\/title>\n<meta name=\"description\" content=\"1. Overview In this tutorial, we will review the basics of Spring Cloud Config Server. We will setup a Config Server and then build a client application\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.javacodegeeks.com\/2017\/12\/intro-spring-cloud-config-server.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Intro to Spring Cloud Config Server - Java Code Geeks\" \/>\n<meta property=\"og:description\" content=\"1. Overview In this tutorial, we will review the basics of Spring Cloud Config Server. We will setup a Config Server and then build a client application\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.javacodegeeks.com\/2017\/12\/intro-spring-cloud-config-server.html\" \/>\n<meta property=\"og:site_name\" content=\"Java Code Geeks\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/javacodegeeks\" \/>\n<meta property=\"article:published_time\" content=\"2017-12-20T08:00:36+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"150\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Michael Good\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:site\" content=\"@javacodegeeks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Michael Good\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/12\\\/intro-spring-cloud-config-server.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/12\\\/intro-spring-cloud-config-server.html\"},\"author\":{\"name\":\"Michael Good\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/d13cc729556b91450ae21878a82139ed\"},\"headline\":\"Intro to Spring Cloud Config Server\",\"datePublished\":\"2017-12-20T08:00:36+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/12\\\/intro-spring-cloud-config-server.html\"},\"wordCount\":973,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/12\\\/intro-spring-cloud-config-server.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"keywords\":[\"Spring Cloud\"],\"articleSection\":[\"Enterprise Java\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/12\\\/intro-spring-cloud-config-server.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/12\\\/intro-spring-cloud-config-server.html\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/12\\\/intro-spring-cloud-config-server.html\",\"name\":\"Intro to Spring Cloud Config Server - Java Code Geeks\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/12\\\/intro-spring-cloud-config-server.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/12\\\/intro-spring-cloud-config-server.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"datePublished\":\"2017-12-20T08:00:36+00:00\",\"description\":\"1. Overview In this tutorial, we will review the basics of Spring Cloud Config Server. We will setup a Config Server and then build a client application\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/12\\\/intro-spring-cloud-config-server.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/12\\\/intro-spring-cloud-config-server.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/12\\\/intro-spring-cloud-config-server.html#primaryimage\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2012\\\/10\\\/enterprise-java-logo.jpg\",\"width\":150,\"height\":150,\"caption\":\"java-interview-questions-answers\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/2017\\\/12\\\/intro-spring-cloud-config-server.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Enterprise Java\",\"item\":\"https:\\\/\\\/www.javacodegeeks.com\\\/category\\\/java\\\/enterprise-java\"},{\"@type\":\"ListItem\",\"position\":4,\"name\":\"Intro to Spring Cloud Config Server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#website\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"name\":\"Java Code Geeks\",\"description\":\"Java Developers Resource Center\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\"},\"alternateName\":\"JCG\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.javacodegeeks.com\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#organization\",\"name\":\"Exelixis Media P.C.\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.javacodegeeks.com\\\/wp-content\\\/uploads\\\/2022\\\/06\\\/exelixis-logo.png\",\"width\":864,\"height\":246,\"caption\":\"Exelixis Media P.C.\"},\"image\":{\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/javacodegeeks\",\"https:\\\/\\\/x.com\\\/javacodegeeks\"]},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.javacodegeeks.com\\\/#\\\/schema\\\/person\\\/d13cc729556b91450ae21878a82139ed\",\"name\":\"Michael Good\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/dc6ef7dbff80afe08a3cdc3b0677aaa26021085e041ce1873dc2141bc581b623?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/dc6ef7dbff80afe08a3cdc3b0677aaa26021085e041ce1873dc2141bc581b623?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/dc6ef7dbff80afe08a3cdc3b0677aaa26021085e041ce1873dc2141bc581b623?s=96&d=mm&r=g\",\"caption\":\"Michael Good\"},\"description\":\"Michael is a software engineer located in the Washington DC area that is interested in Java, cyber security, and open source technologies. Follow his personal blog to read more from Michael.\",\"sameAs\":[\"http:\\\/\\\/www.michaelcgood.com\"],\"url\":\"https:\\\/\\\/www.javacodegeeks.com\\\/author\\\/michael-good\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Intro to Spring Cloud Config Server - Java Code Geeks","description":"1. Overview In this tutorial, we will review the basics of Spring Cloud Config Server. We will setup a Config Server and then build a client application","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.javacodegeeks.com\/2017\/12\/intro-spring-cloud-config-server.html","og_locale":"en_US","og_type":"article","og_title":"Intro to Spring Cloud Config Server - Java Code Geeks","og_description":"1. Overview In this tutorial, we will review the basics of Spring Cloud Config Server. We will setup a Config Server and then build a client application","og_url":"https:\/\/www.javacodegeeks.com\/2017\/12\/intro-spring-cloud-config-server.html","og_site_name":"Java Code Geeks","article_publisher":"https:\/\/www.facebook.com\/javacodegeeks","article_published_time":"2017-12-20T08:00:36+00:00","og_image":[{"width":150,"height":150,"url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","type":"image\/jpeg"}],"author":"Michael Good","twitter_card":"summary_large_image","twitter_creator":"@javacodegeeks","twitter_site":"@javacodegeeks","twitter_misc":{"Written by":"Michael Good","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.javacodegeeks.com\/2017\/12\/intro-spring-cloud-config-server.html#article","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/12\/intro-spring-cloud-config-server.html"},"author":{"name":"Michael Good","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/d13cc729556b91450ae21878a82139ed"},"headline":"Intro to Spring Cloud Config Server","datePublished":"2017-12-20T08:00:36+00:00","mainEntityOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/12\/intro-spring-cloud-config-server.html"},"wordCount":973,"commentCount":0,"publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/12\/intro-spring-cloud-config-server.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","keywords":["Spring Cloud"],"articleSection":["Enterprise Java"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.javacodegeeks.com\/2017\/12\/intro-spring-cloud-config-server.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.javacodegeeks.com\/2017\/12\/intro-spring-cloud-config-server.html","url":"https:\/\/www.javacodegeeks.com\/2017\/12\/intro-spring-cloud-config-server.html","name":"Intro to Spring Cloud Config Server - Java Code Geeks","isPartOf":{"@id":"https:\/\/www.javacodegeeks.com\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/12\/intro-spring-cloud-config-server.html#primaryimage"},"image":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/12\/intro-spring-cloud-config-server.html#primaryimage"},"thumbnailUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","datePublished":"2017-12-20T08:00:36+00:00","description":"1. Overview In this tutorial, we will review the basics of Spring Cloud Config Server. We will setup a Config Server and then build a client application","breadcrumb":{"@id":"https:\/\/www.javacodegeeks.com\/2017\/12\/intro-spring-cloud-config-server.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.javacodegeeks.com\/2017\/12\/intro-spring-cloud-config-server.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/2017\/12\/intro-spring-cloud-config-server.html#primaryimage","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2012\/10\/enterprise-java-logo.jpg","width":150,"height":150,"caption":"java-interview-questions-answers"},{"@type":"BreadcrumbList","@id":"https:\/\/www.javacodegeeks.com\/2017\/12\/intro-spring-cloud-config-server.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.javacodegeeks.com\/"},{"@type":"ListItem","position":2,"name":"Java","item":"https:\/\/www.javacodegeeks.com\/category\/java"},{"@type":"ListItem","position":3,"name":"Enterprise Java","item":"https:\/\/www.javacodegeeks.com\/category\/java\/enterprise-java"},{"@type":"ListItem","position":4,"name":"Intro to Spring Cloud Config Server"}]},{"@type":"WebSite","@id":"https:\/\/www.javacodegeeks.com\/#website","url":"https:\/\/www.javacodegeeks.com\/","name":"Java Code Geeks","description":"Java Developers Resource Center","publisher":{"@id":"https:\/\/www.javacodegeeks.com\/#organization"},"alternateName":"JCG","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.javacodegeeks.com\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.javacodegeeks.com\/#organization","name":"Exelixis Media P.C.","url":"https:\/\/www.javacodegeeks.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/","url":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","contentUrl":"https:\/\/www.javacodegeeks.com\/wp-content\/uploads\/2022\/06\/exelixis-logo.png","width":864,"height":246,"caption":"Exelixis Media P.C."},"image":{"@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/javacodegeeks","https:\/\/x.com\/javacodegeeks"]},{"@type":"Person","@id":"https:\/\/www.javacodegeeks.com\/#\/schema\/person\/d13cc729556b91450ae21878a82139ed","name":"Michael Good","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/dc6ef7dbff80afe08a3cdc3b0677aaa26021085e041ce1873dc2141bc581b623?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/dc6ef7dbff80afe08a3cdc3b0677aaa26021085e041ce1873dc2141bc581b623?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/dc6ef7dbff80afe08a3cdc3b0677aaa26021085e041ce1873dc2141bc581b623?s=96&d=mm&r=g","caption":"Michael Good"},"description":"Michael is a software engineer located in the Washington DC area that is interested in Java, cyber security, and open source technologies. Follow his personal blog to read more from Michael.","sameAs":["http:\/\/www.michaelcgood.com"],"url":"https:\/\/www.javacodegeeks.com\/author\/michael-good"}]}},"_links":{"self":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/71572","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/users\/5558"}],"replies":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/comments?post=71572"}],"version-history":[{"count":0,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/posts\/71572\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media\/112"}],"wp:attachment":[{"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/media?parent=71572"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/categories?post=71572"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.javacodegeeks.com\/wp-json\/wp\/v2\/tags?post=71572"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}