Files
spring-cloud-config/docs/src/main/asciidoc
2017-02-24 11:45:09 -05:00
..
2016-08-22 13:31:24 +02:00
2015-12-17 17:51:28 +01:00
2016-09-27 12:58:26 +08:00
2017-02-24 11:45:09 -05:00

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
image::https://circleci.com/gh/spring-cloud/spring-cloud-config/tree/master.svg?style=svg["CircleCI", link="https://circleci.com/gh/spring-cloud/spring-cloud-config/tree/master"]
image::https://codecov.io/gh/spring-cloud/spring-cloud-config/branch/master/graph/badge.svg["Codecov", link="https://codecov.io/gh/spring-cloud/spring-cloud-config/branch/master"]
image::https://api.codacy.com/project/badge/Grade/f064024a072c477e97dca6ed5a70fccd?branch=master["Codacy code quality", link="https://www.codacy.com/app/Spring-Cloud/spring-cloud-config?branch=master&utm_source=github.com&utm_medium=referral&utm_content=spring-cloud/spring-cloud-config&utm_campaign=Badge_Grade"]

include::intro.adoc[]

== Features

=== Spring Cloud Config Server

* HTTP, resource-based API for external configuration (name-value pairs, or equivalent YAML content)
* Encrypt and decrypt property values (symmetric or asymmetric)
* Embeddable easily in a Spring Boot application using `@EnableConfigServer`

=== Spring Cloud Config Client

Specifically for Spring applications:

* Bind to the Config Server and initialize Spring `Environment` with remote property sources
* Encrypt and decrypt property values (symmetric or asymmetric)
* `@RefreshScope` for Spring `@Beans` that want to be re-initialized when configuration changes
* Management endpoints:
** `/env` for updating `Environment` and rebinding `@ConfigurationProperties` and log levels
** `/refresh` for refreshing the `@RefreshScope` beans
** `/restart` for restarting the Spring context (disabled by default)
** `/pause` and `/resume` for calling the `Lifecycle` methods (`stop()` and `start()` on the `ApplicationContext`)
* Bootstrap application context: a parent context for the main application that can be trained to do anything (by default it binds to the Config Server, and decrypts property values)

== Quick Start

include::quickstart.adoc[]

=== Sample Application

There is a sample application
https://github.com/spring-cloud/spring-cloud-config/tree/master/spring-cloud-config-sample[here]. It
is a Spring Boot application so you can run it using the usual
mechanisms (for instance "mvn spring-boot:run"). When it runs it will
look for the config server on "http://localhost:8888" by default, so
you could run the server as well to see it all working together.

The sample has a test case where the config server is also started in
the same JVM (with a different port), and the test asserts that an
environment property from the git configuration repo is present. To
change the location of the config server just set
"spring.cloud.config.uri" in "bootstrap.yml" (or via System
properties etc.).

The test case has a `main()` method that runs the server in the same
way (watch the logs for its port), so you can run the whole system in
one process and play with it (e.g. right click on the main in your IDE
and run it). The `main()` method uses `target/config` for the working
directory of the git repository, so you can make local changes there
and see them reflected in the running app.

----
$ curl localhost:8080/env/foo
bar
$ vi target/config/bar.properties
.. change value of "foo", optionally commit
$ curl localhost:8080/refresh
["foo"]
$ curl localhost:8080/env/foo
baz
----

The refresh endpoint reports that the "foo" property changed.

== Building

=== JCE

If you are getting an exception due to "Illegal key size" and you
are using Suns JDK, you need to install the Java Cryptography
Extension (JCE) Unlimited Strength Jurisdiction Policy Files. See
the following links for more information:

http://www.oracle.com/technetwork/java/javase/downloads/jce-6-download-429243.html[Java 6 JCE]

http://www.oracle.com/technetwork/java/javase/downloads/jce-7-download-432124.html[Java 7 JCE]

http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html[Java 8 JCE]

Extract files into JDK/jre/lib/security folder (whichever version of JRE/JDK x64/x86 you are using).

include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/building.adoc[]

== Contributing

include::https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/master/docs/src/main/asciidoc/contributing.adoc[]