Spring Cloud Config Server Native Example
Spring Cloud Config Server Native Example. On Windows, you need an extra "/" in the file URL if it is absolute with a drive prefix (for example, /$ user.home/config-repo ). The following example gets configuration from a git repository (which must be provided), as shown in the following example: spring: cloud: config: server: git: uri: https://github.com/spring-cloud-samples/config-repo Other sources are any JDBC compatible database, Subversion, Hashicorp Vault, Credhub and local filesystems.
In this case, it may not be worth the effort to migrate it to git. The following listing shows a recipe for creating the git repository in the preceding example: $ cd $HOME $ mkdir config-repo $ cd config-repo $ git init. $ echo info.foo: bar > application.properties $ git add -A . $ git commit -m "Add application.properties" Using the local filesystem for your git repository is intended for testing only. Then try out a client: 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 server endpoints, you can (optionally) set spring.cloud.config.server.prefix (for example, /config), to serve the resources under a prefix.
It initializes an empty git repository.
Example: Let's get started with an example. On Windows, you need an extra "/" in the file URL if it is absolute with a drive prefix (for example, /$ user.home/config-repo ). To change the location of the config server, you can set spring.cloud.config.uri in bootstrap.yml (or in system properties and other places).