├── .github └── dco.yml ├── .gitignore ├── README.md ├── client ├── pom.xml └── src │ └── main │ ├── java │ └── demo │ │ ├── ConfigClientApplication.java │ │ └── HomeController.java │ └── resources │ └── bootstrap.yml └── server ├── pom.xml └── src ├── main ├── java │ └── demo │ │ └── ConfigServerApplication.java └── resources │ └── application.yml └── test └── java └── demo └── ApplicationTests.java /.github/dco.yml: -------------------------------------------------------------------------------- 1 | require: 2 | members: false 3 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Operating System Files 2 | 3 | *.DS_Store 4 | Thumbs.db 5 | *.sw? 6 | .#* 7 | *# 8 | *~ 9 | 10 | # Build Artifacts 11 | 12 | .gradle/ 13 | build/ 14 | target/ 15 | bin/ 16 | 17 | # Eclipse Project Files 18 | 19 | .classpath 20 | .project 21 | .settings/ 22 | 23 | # IntelliJ IDEA Files 24 | 25 | .idea/ 26 | *.iml 27 | *.iws 28 | *.ipr 29 | 30 | # Sublime 31 | 32 | *.sublime-* 33 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # spring-cloud-config-server-sample 2 | -------------------------------------------------------------------------------- /client/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.demo 7 | config-server-client 8 | 0.1.0 9 | jar 10 | 11 | 12 | org.springframework.boot 13 | spring-boot-starter-parent 14 | 1.3.1.RELEASE 15 | 16 | 17 | 18 | 19 | 1.8 20 | 21 | 22 | 23 | 24 | 25 | org.springframework.cloud 26 | spring-cloud-starter-parent 27 | Brixton.BUILD-SNAPSHOT 28 | pom 29 | import 30 | 31 | 32 | 33 | 34 | 35 | org.springframework.boot 36 | spring-boot-starter-actuator 37 | 38 | 39 | org.springframework.boot 40 | spring-boot-starter-web 41 | 42 | 43 | org.springframework.cloud 44 | spring-cloud-starter-config 45 | 46 | 47 | org.springframework.boot 48 | spring-boot-starter-test 49 | test 50 | 51 | 52 | 53 | 54 | 55 | 56 | org.springframework.boot 57 | spring-boot-maven-plugin 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /client/src/main/java/demo/ConfigClientApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | 6 | @SpringBootApplication 7 | public class ConfigClientApplication { 8 | 9 | public static void main(String[] args) { 10 | SpringApplication.run(ConfigClientApplication.class, args); 11 | } 12 | 13 | } 14 | -------------------------------------------------------------------------------- /client/src/main/java/demo/HomeController.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.beans.factory.annotation.Value; 4 | import org.springframework.web.bind.annotation.RequestMapping; 5 | import org.springframework.web.bind.annotation.RestController; 6 | 7 | @RestController 8 | public class HomeController { 9 | 10 | private static final String template = "Hello, %s!"; 11 | 12 | @Value("${foo:World}") 13 | private String name; 14 | 15 | @RequestMapping("/") 16 | public String home() { 17 | return String.format(template, name); 18 | } 19 | 20 | } 21 | -------------------------------------------------------------------------------- /client/src/main/resources/bootstrap.yml: -------------------------------------------------------------------------------- 1 | spring: 2 | application: 3 | name: foo 4 | cloud: 5 | config: 6 | uri: http://localhost:${config.port:8888} 7 | -------------------------------------------------------------------------------- /server/pom.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 4.0.0 5 | 6 | org.demo 7 | config-server 8 | 0.0.1-SNAPSHOT 9 | jar 10 | 11 | configserver 12 | Config Server 13 | 14 | 15 | org.springframework.boot 16 | spring-boot-starter-parent 17 | 1.3.1.RELEASE 18 | 19 | 20 | 21 | 22 | 1.8 23 | 24 | 25 | 26 | 27 | 28 | org.springframework.cloud 29 | spring-cloud-starter-parent 30 | Brixton.BUILD-SNAPSHOT 31 | pom 32 | import 33 | 34 | 35 | 36 | 37 | 38 | 39 | org.springframework.cloud 40 | spring-cloud-config-server 41 | 42 | 43 | org.tmatesoft.svnkit 44 | svnkit 45 | 46 | 47 | org.springframework.boot 48 | spring-boot-starter-test 49 | test 50 | 51 | 52 | 53 | 54 | 55 | 56 | org.springframework.boot 57 | spring-boot-maven-plugin 58 | 59 | 60 | 61 | 62 | 63 | -------------------------------------------------------------------------------- /server/src/main/java/demo/ConfigServerApplication.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.springframework.boot.SpringApplication; 4 | import org.springframework.boot.autoconfigure.SpringBootApplication; 5 | import org.springframework.cloud.config.server.EnableConfigServer; 6 | 7 | @SpringBootApplication 8 | @EnableConfigServer 9 | public class ConfigServerApplication { 10 | 11 | public static void main(String[] args) { 12 | SpringApplication.run(ConfigServerApplication.class, args); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /server/src/main/resources/application.yml: -------------------------------------------------------------------------------- 1 | server: 2 | port: 8888 3 | 4 | spring: 5 | cloud: 6 | config: 7 | server: 8 | svn: 9 | uri: https://subversion.assembla.com/svn/spring-cloud-config-repo/ 10 | #git: 11 | # uri: https://github.com/pcf-guides/configuration-server-config-repo 12 | default-label: trunk 13 | profiles: 14 | active: subversion 15 | 16 | logging: 17 | levels: 18 | org.springframework.boot.env.PropertySourcesLoader: TRACE 19 | org.springframework.cloud.config.server: DEBUG 20 | -------------------------------------------------------------------------------- /server/src/test/java/demo/ApplicationTests.java: -------------------------------------------------------------------------------- 1 | package demo; 2 | 3 | import org.junit.Test; 4 | import org.junit.runner.RunWith; 5 | import org.springframework.test.context.web.WebAppConfiguration; 6 | import org.springframework.boot.test.SpringApplicationConfiguration; 7 | import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; 8 | 9 | @RunWith(SpringJUnit4ClassRunner.class) 10 | @SpringApplicationConfiguration(classes = ConfigServerApplication.class) 11 | @WebAppConfiguration 12 | public class ApplicationTests { 13 | 14 | @Test 15 | public void contextLoads() { 16 | } 17 | 18 | } 19 | --------------------------------------------------------------------------------