diff --git a/docs/src/main/asciidoc/quickstart.adoc b/docs/src/main/asciidoc/quickstart.adoc index 202d0230..5b504a40 100644 --- a/docs/src/main/asciidoc/quickstart.adoc +++ b/docs/src/main/asciidoc/quickstart.adoc @@ -5,9 +5,9 @@ $ cd spring-cloud-config-server $ mvn spring-boot:run ---- -The server is a Spring Boot application so you can build the jar file -and run that (`java -jar ...`) or pull it down from a Maven -repository. Then try it out as a client: +The server is a Spring Boot application so you can run it from your +IDE instead if you prefer (the main class is +`ConfigServerApplication`). Then try it out a client: ---- $ curl localhost:8888/foo/development diff --git a/docs/src/main/asciidoc/spring-cloud-config.adoc b/docs/src/main/asciidoc/spring-cloud-config.adoc index 1bbc431e..ba3433c4 100644 --- a/docs/src/main/asciidoc/spring-cloud-config.adoc +++ b/docs/src/main/asciidoc/spring-cloud-config.adoc @@ -40,10 +40,10 @@ to use your own `application.properties`, e.g. [source,properties] ---- server.port: 8888 -spring.cloud.config.server.git.uri: file://${HOME}/config-repo +spring.cloud.config.server.git.uri: file://${user.home}/config-repo ---- -where `${HOME}/config-repo` is a git repository containing +where `${user.home}/config-repo` is a git repository containing YAML and properties files. [TIP] diff --git a/spring-cloud-config-server/pom.xml b/spring-cloud-config-server/pom.xml index 5fa47bec..79777069 100644 --- a/spring-cloud-config-server/pom.xml +++ b/spring-cloud-config-server/pom.xml @@ -50,11 +50,11 @@ org.yaml snakeyaml - - org.tmatesoft.svnkit - svnkit - true - + + org.tmatesoft.svnkit + svnkit + true + org.springframework.boot spring-boot-starter-test @@ -69,16 +69,4 @@ 1.7 - - - - org.springframework.boot - spring-boot-maven-plugin - - exec - - - - - diff --git a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/ConfigServerApplication.java b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/ConfigServerApplication.java index f3d42d0f..6f026817 100644 --- a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/ConfigServerApplication.java +++ b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/ConfigServerApplication.java @@ -10,8 +10,8 @@ import org.springframework.context.annotation.Configuration; public class ConfigServerApplication { public static void main(String[] args) { - new SpringApplicationBuilder(ConfigServerApplication.class).properties( - "spring.config.name=configserver", "debug=true").run(args); + new SpringApplicationBuilder(ConfigServerApplication.class) + .properties("spring.config.name=configserver").run(args); } } diff --git a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/config/ConfigServerMvcConfiguration.java b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/config/ConfigServerMvcConfiguration.java index 9673f5fb..1e28e471 100644 --- a/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/config/ConfigServerMvcConfiguration.java +++ b/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/config/ConfigServerMvcConfiguration.java @@ -25,6 +25,9 @@ import org.springframework.cloud.config.server.resource.ResourceController; import org.springframework.cloud.config.server.resource.ResourceRepository; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.http.MediaType; +import org.springframework.web.servlet.config.annotation.ContentNegotiationConfigurer; +import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; /** * @author Dave Syer @@ -32,7 +35,8 @@ import org.springframework.context.annotation.Configuration; */ @Configuration @ConditionalOnWebApplication -public class ConfigServerMvcConfiguration { +public class ConfigServerMvcConfiguration extends WebMvcConfigurerAdapter { + @Autowired private EnvironmentRepository repository; @@ -42,9 +46,16 @@ public class ConfigServerMvcConfiguration { @Autowired private ConfigServerProperties server; - @Autowired(required=false) + @Autowired(required = false) private EnvironmentEncryptor environmentEncryptor; + @Override + public void configureContentNegotiation(ContentNegotiationConfigurer configurer) { + configurer.mediaType("properties", MediaType.valueOf("text/plain")); + configurer.mediaType("yml", MediaType.valueOf("text/yaml")); + configurer.mediaType("yaml", MediaType.valueOf("text/yaml")); + } + @Bean public EnvironmentController environmentController() { EnvironmentController controller = new EnvironmentController(encrypted()); @@ -54,12 +65,14 @@ public class ConfigServerMvcConfiguration { @Bean public ResourceController resourceController() { - ResourceController controller = new ResourceController(this.resources, encrypted()); + ResourceController controller = new ResourceController(this.resources, + encrypted()); return controller; } private EnvironmentEncryptorEnvironmentRepository encrypted() { - EnvironmentEncryptorEnvironmentRepository encrypted = new EnvironmentEncryptorEnvironmentRepository(this.repository, this.environmentEncryptor); + EnvironmentEncryptorEnvironmentRepository encrypted = new EnvironmentEncryptorEnvironmentRepository( + this.repository, this.environmentEncryptor); encrypted.setOverrides(this.server.getOverrides()); return encrypted; }