GithubHelp home page GithubHelp logo

spring-cloud / spring-cloud-config Goto Github PK

View Code? Open in Web Editor NEW
1.9K 189.0 1.3K 38.53 MB

External configuration (server and client) for Spring Cloud

License: Apache License 2.0

Ruby 0.03% Groovy 0.01% Java 96.58% Shell 3.38%
java spring spring-boot spring-cloud microservices cloud-native git vault spring-cloud-core

spring-cloud-config's Introduction

CircleCI
Codecov
Codacy code quality

Features

Spring Cloud Config Server

Spring Cloud Config Server offers the following benefits:

  • 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, Spring Cloud Config Client lets you:

  • 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.

  • Use 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

Sample Application

You can find a sample application here. It is a Spring Boot application, so you can run it by using the usual mechanisms (for instance, mvn spring-boot:run). When it runs, it looks for the config server on http://localhost:8888 (a configurable default), so you can 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, you can set spring.cloud.config.uri in bootstrap.yml (or in system properties and other places).

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 (for example, you can run the main() method in your IDE). 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. The following example shows a session of tinkering with the test case:

$ curl localhost:8080/env/sample
mytest
$ vi target/config/mytest.properties
.. change value of "sample", optionally commit
$ curl -X POST localhost:8080/refresh
["sample"]
$ curl localhost:8080/env/sample
sampleValue

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

Building

Basic Compile and Test

To build the source you will need to install JDK 17.

Spring Cloud uses Maven for most build-related activities, and you should be able to get off the ground quite quickly by cloning the project you are interested in and typing

$ ./mvnw install
Note
You can also install Maven (>=3.3.3) yourself and run the mvn command in place of ./mvnw in the examples below. If you do that you also might need to add -P spring if your local Maven settings do not contain repository declarations for spring pre-release artifacts.
Note
Be aware that you might need to increase the amount of memory available to Maven by setting a MAVEN_OPTS environment variable with a value like -Xmx512m -XX:MaxPermSize=128m. We try to cover this in the .mvn configuration, so if you find you have to do it to make a build succeed, please raise a ticket to get the settings added to source control.

The projects that require middleware (i.e. Redis) for testing generally require that a local instance of [Docker](https://www.docker.com/get-started) is installed and running.

Documentation

The spring-cloud-build module has a "docs" profile, and if you switch that on it will try to build asciidoc sources using Antora from modules/ROOT/.

As part of that process it will look for a docs/src/main/asciidoc/README.adoc and process it by loading all the includes, but not parsing or rendering it, just copying it to ${main.basedir} (defaults to ${basedir}, i.e. the root of the project). If there are any changes in the README it will then show up after a Maven build as a modified file in the correct place. Just commit it and push the change.

Working with the code

If you don’t have an IDE preference we would recommend that you use Spring Tools Suite or Eclipse when working with the code. We use the m2eclipse eclipse plugin for maven support. Other IDEs and tools should also work without issue as long as they use Maven 3.3.3 or better.

Activate the Spring Maven profile

Spring Cloud projects require the 'spring' Maven profile to be activated to resolve the spring milestone and snapshot repositories. Use your preferred IDE to set this profile to be active, or you may experience build errors.

Importing into eclipse with m2eclipse

We recommend the m2eclipse eclipse plugin when working with eclipse. If you don’t already have m2eclipse installed it is available from the "eclipse marketplace".

Note
Older versions of m2e do not support Maven 3.3, so once the projects are imported into Eclipse you will also need to tell m2eclipse to use the right profile for the projects. If you see many different errors related to the POMs in the projects, check that you have an up to date installation. If you can’t upgrade m2e, add the "spring" profile to your settings.xml. Alternatively you can copy the repository settings from the "spring" profile of the parent pom into your settings.xml.

Importing into eclipse without m2eclipse

If you prefer not to use m2eclipse you can generate eclipse project metadata using the following command:

$ ./mvnw eclipse:eclipse

The generated eclipse projects can be imported by selecting import existing projects from the file menu.

JCE

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

Extract the JCE files into the JDK/jre/lib/security folder for whichever version of JRE/JDK x64/x86 you use.

Contributing

Spring Cloud is released under the non-restrictive Apache 2.0 license, and follows a very standard Github development process, using Github tracker for issues and merging pull requests into main. If you want to contribute even something trivial please do not hesitate, but follow the guidelines below.

Sign the Contributor License Agreement

Before we accept a non-trivial patch or pull request we will need you to sign the Contributor License Agreement. Signing the contributor’s agreement does not grant anyone commit rights to the main repository, but it does mean that we can accept your contributions, and you will get an author credit if we do. Active contributors might be asked to join the core team, and given the ability to merge pull requests.

Code of Conduct

This project adheres to the Contributor Covenant code of conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to [email protected].

Code Conventions and Housekeeping

None of these is essential for a pull request, but they will all help. They can also be added after the original pull request but before a merge.

  • Use the Spring Framework code format conventions. If you use Eclipse you can import formatter settings using the eclipse-code-formatter.xml file from the Spring Cloud Build project. If using IntelliJ, you can use the Eclipse Code Formatter Plugin to import the same file.

  • Make sure all new .java files to have a simple Javadoc class comment with at least an @author tag identifying you, and preferably at least a paragraph on what the class is for.

  • Add the ASF license header comment to all new .java files (copy from existing files in the project)

  • Add yourself as an @author to the .java files that you modify substantially (more than cosmetic changes).

  • Add some Javadocs and, if you change the namespace, some XSD doc elements.

  • A few unit tests would help a lot as well — someone has to do it.

  • If no-one else is using your branch, please rebase it against the current main (or other target branch in the main project).

  • When writing a commit message please follow these conventions, if you are fixing an existing issue please add Fixes gh-XXXX at the end of the commit message (where XXXX is the issue number).

Checkstyle

Spring Cloud Build comes with a set of checkstyle rules. You can find them in the spring-cloud-build-tools module. The most notable files under the module are:

spring-cloud-build-tools/
└── src
    ├── checkstyle
    │   └── checkstyle-suppressions.xml (3)
    └── main
        └── resources
            ├── checkstyle-header.txt (2)
            └── checkstyle.xml (1)
  1. Default Checkstyle rules

  2. File header setup

  3. Default suppression rules

Checkstyle configuration

Checkstyle rules are disabled by default. To add checkstyle to your project just define the following properties and plugins.

pom.xml
<properties>
<maven-checkstyle-plugin.failsOnError>true</maven-checkstyle-plugin.failsOnError> (1)
        <maven-checkstyle-plugin.failsOnViolation>true
        </maven-checkstyle-plugin.failsOnViolation> (2)
        <maven-checkstyle-plugin.includeTestSourceDirectory>true
        </maven-checkstyle-plugin.includeTestSourceDirectory> (3)
</properties>

<build>
        <plugins>
            <plugin> (4)
                <groupId>io.spring.javaformat</groupId>
                <artifactId>spring-javaformat-maven-plugin</artifactId>
            </plugin>
            <plugin> (5)
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
            </plugin>
        </plugins>

    <reporting>
        <plugins>
            <plugin> (5)
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
            </plugin>
        </plugins>
    </reporting>
</build>
  1. Fails the build upon Checkstyle errors

  2. Fails the build upon Checkstyle violations

  3. Checkstyle analyzes also the test sources

  4. Add the Spring Java Format plugin that will reformat your code to pass most of the Checkstyle formatting rules

  5. Add checkstyle plugin to your build and reporting phases

If you need to suppress some rules (e.g. line length needs to be longer), then it’s enough for you to define a file under ${project.root}/src/checkstyle/checkstyle-suppressions.xml with your suppressions. Example:

projectRoot/src/checkstyle/checkstyle-suppresions.xml
<?xml version="1.0"?>
<!DOCTYPE suppressions PUBLIC
		"-//Puppy Crawl//DTD Suppressions 1.1//EN"
		"https://www.puppycrawl.com/dtds/suppressions_1_1.dtd">
<suppressions>
	<suppress files=".*ConfigServerApplication\.java" checks="HideUtilityClassConstructor"/>
	<suppress files=".*ConfigClientWatch\.java" checks="LineLengthCheck"/>
</suppressions>

It’s advisable to copy the ${spring-cloud-build.rootFolder}/.editorconfig and ${spring-cloud-build.rootFolder}/.springformat to your project. That way, some default formatting rules will be applied. You can do so by running this script:

$ curl https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/.editorconfig -o .editorconfig
$ touch .springformat

IDE setup

Intellij IDEA

In order to setup Intellij you should import our coding conventions, inspection profiles and set up the checkstyle plugin. The following files can be found in the Spring Cloud Build project.

spring-cloud-build-tools/
└── src
    ├── checkstyle
    │   └── checkstyle-suppressions.xml (3)
    └── main
        └── resources
            ├── checkstyle-header.txt (2)
            ├── checkstyle.xml (1)
            └── intellij
                ├── Intellij_Project_Defaults.xml (4)
                └── Intellij_Spring_Boot_Java_Conventions.xml (5)
  1. Default Checkstyle rules

  2. File header setup

  3. Default suppression rules

  4. Project defaults for Intellij that apply most of Checkstyle rules

  5. Project style conventions for Intellij that apply most of Checkstyle rules

Code style
Figure 1. Code style

Go to FileSettingsEditorCode style. There click on the icon next to the Scheme section. There, click on the Import Scheme value and pick the Intellij IDEA code style XML option. Import the spring-cloud-build-tools/src/main/resources/intellij/Intellij_Spring_Boot_Java_Conventions.xml file.

Code style
Figure 2. Inspection profiles

Go to FileSettingsEditorInspections. There click on the icon next to the Profile section. There, click on the Import Profile and import the spring-cloud-build-tools/src/main/resources/intellij/Intellij_Project_Defaults.xml file.

Checkstyle

To have Intellij work with Checkstyle, you have to install the Checkstyle plugin. It’s advisable to also install the Assertions2Assertj to automatically convert the JUnit assertions

Checkstyle

Go to FileSettingsOther settingsCheckstyle. There click on the + icon in the Configuration file section. There, you’ll have to define where the checkstyle rules should be picked from. In the image above, we’ve picked the rules from the cloned Spring Cloud Build repository. However, you can point to the Spring Cloud Build’s GitHub repository (e.g. for the checkstyle.xml : https://raw.githubusercontent.com/spring-cloud/spring-cloud-build/main/spring-cloud-build-tools/src/main/resources/checkstyle.xml). We need to provide the following variables:

Important
Remember to set the Scan Scope to All sources since we apply checkstyle rules for production and test sources.

Duplicate Finder

Spring Cloud Build brings along the basepom:duplicate-finder-maven-plugin, that enables flagging duplicate and conflicting classes and resources on the java classpath.

Duplicate Finder configuration

Duplicate finder is enabled by default and will run in the verify phase of your Maven build, but it will only take effect in your project if you add the duplicate-finder-maven-plugin to the build section of the projecst’s pom.xml.

pom.xml
<build>
    <plugins>
        <plugin>
            <groupId>org.basepom.maven</groupId>
            <artifactId>duplicate-finder-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

For other properties, we have set defaults as listed in the plugin documentation.

You can easily override them but setting the value of the selected property prefixed with duplicate-finder-maven-plugin. For example, set duplicate-finder-maven-plugin.skip to true in order to skip duplicates check in your build.

If you need to add ignoredClassPatterns or ignoredResourcePatterns to your setup, make sure to add them in the plugin configuration section of your project:

<build>
    <plugins>
        <plugin>
            <groupId>org.basepom.maven</groupId>
            <artifactId>duplicate-finder-maven-plugin</artifactId>
            <configuration>
                <ignoredClassPatterns>
                    <ignoredClassPattern>org.joda.time.base.BaseDateTime</ignoredClassPattern>
                    <ignoredClassPattern>.*module-info</ignoredClassPattern>
                </ignoredClassPatterns>
                <ignoredResourcePatterns>
                    <ignoredResourcePattern>changelog.txt</ignoredResourcePattern>
                </ignoredResourcePatterns>
            </configuration>
        </plugin>
    </plugins>
</build>

spring-cloud-config's People

Contributors

antechrestos avatar copa2 avatar daniellavoie avatar dependabot-preview[bot] avatar dyroberts avatar eidottermihi avatar fifthposition avatar haybu avatar indraneelb1903 avatar izeye avatar kamalakarp avatar kvmw avatar marcingrzejszczak avatar mbenson avatar mp911de avatar olgamaciaszek avatar pearsonradu avatar robertmcnees avatar ryanjbaxter avatar scottfrederick avatar spencergibb avatar spring-builds avatar tapvirvirk avatar tdanylchuk avatar thomasvitale avatar tomcruise81 avatar tysewyn avatar walliee avatar wind57 avatar woshikid avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spring-cloud-config's Issues

Define the security model for Cloud Config

It's not clear how one would protect the config server and ensure only authorized clients can access the configuration information contained therein. It would be nice to define the security model or future intentions in this regard.

Add spring-cloud-config-server ability to configure "isolated" NativeEnvironmentRepository configuration

It would be nice to be able to use the native profile and be able to specify a configuration file that doesn't include other properties from the spring-cloud-config-server's environment such as server.port, admin path, etc. thus making it more "isolated". This would be similar to how JGitEnvironmentRepository currently works with repo contained files. It would be very useful when first starting out with the cloud config project because it would enable a straightforward migration path to eventually using git.

Perhaps this could be implemented as a new profile or repository type?

Config from local git repo not updated

In my bootstrap.yml I have:

spring:
  application:
    name: configserver
  cloud:
    config:
      enabled: false
      server:
        git:
          uri: file:///tmp/git
          basedir: target/config

Create local repo:

$ cat appmaster.yml 
bar: "mybar222"

$ git init
Initialised empty Git repository in /tmp/git/.git/
/tmp/git [master|…1] 
14:28 $ git add appmaster.yml 
/tmp/git [master|●1] 
14:28 $ git commit -m "update1" -a
[master (root-commit) 988b57a] update1
1 file changed, 2 insertions(+)
create mode 100644 appmaster.yml
/tmp/git [master L|✔] 
14:28 $ git log
commit 988b57a9e13fa13c9a3dc5756e19cfe9de9e0d5c
Author: Janne Valkealahti <[email protected]>
Date:   Fri Jan 16 14:28:22 2015 +0000

    update1

Check what config server gives:

$ curl http://localhost:8888/appmaster/default/master
{"name":"default","label":"","propertySources":[{"name":"file:///tmp/git/appmaster.yml","source":{"bar":"mybar222"}}]}

Looks ok, lets update appmaster.yml in git repo:

$ cat appmaster.yml 
bar: "mybar333"

/tmp/git [master L|✚ 1] 
$ git add appmaster.yml 
/tmp/git [master L|●1] 
$ git commit -m "update2" -a
[master acd9a46] update2
1 file changed, 1 insertion(+), 1 deletion(-)
/tmp/git [master L|✔] 
$ git log
commit acd9a46785ad97b5dd3ea628b35d54c81bcef46c
Author: Janne Valkealahti <[email protected]>
Date:   Fri Jan 16 14:35:39 2015 +0000

    update2

commit 988b57a9e13fa13c9a3dc5756e19cfe9de9e0d5c
Author: Janne Valkealahti <[email protected]>
Date:   Fri Jan 16 14:28:22 2015 +0000

    update1

Check what config server gives after restart:

$ curl http://localhost:8888/appmaster/default/master
{"name":"default","label":"","propertySources":[{"name":"file:///tmp/git/appmaster.yml","source":{"bar":"mybar222"}}]}

Didn't update. lets check cloned repo:

$ cd target/config/
~/repos/work/yarn-cloud/target/config [master L|✔] 
14:39 $ git log
commit 988b57a9e13fa13c9a3dc5756e19cfe9de9e0d5c
Author: Janne Valkealahti <[email protected]>
Date:   Fri Jan 16 14:28:22 2015 +0000

    update1
~/repos/work/yarn-cloud/target/config [master L|✔] 
14:39 $ cat appmaster.yml 
bar: "mybar222"

It looks like repo is cloned once and never updated.

Missing Bean ConfigClientProperties if spring.cloud.config.enabled:false

Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.cloud.config.client.ConfigClientProperties org.springframework.cloud.bootstrap.config.PropertySourceBootstrapConfiguration.configClientProperties; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.cloud.config.client.ConfigClientProperties] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:558)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
... 29 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.cloud.config.client.ConfigClientProperties] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:1308)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1054)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:949)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:530)
... 31 more

if spring.cloud.config.enabled:false, PropertySourceBootstrapConfiguration still tries to inject ConfigClientProperties

file:/ prefix require for Windows

Current spring-cloud-config server doesn't work on windows environment.

I think on windows enviroment "file:/" prefix should added for git.getRepository().getDirectory().getParent();

Add failfast option if config server is not available

For the sake of clarity: by default the app should start irrespective, but if the flag is set and config server is unavailable, refuse to start.

(Fail /refresh as well, but not fatal for the app in that case.)

Simpler Spring Cloud Config approach

I am trying to integrate spring cloud config into our docker micro-service architecture.

Currently spring-cloud-config propagates a client service architecture.
[GitRepp] <---accessedBy--- [Config Server] <---accessedBy--- [Config Client 1..N]

In our case the Config Server is just a main method with all the overhead of (git, gradle, jenkins, docker, versioning, jira, testcases and many more) This is quite a lot for an Application having "only" an empty main method.

While rethinking all this, the only USP that counts for us is the ability to pull the config from a git repository. So suddenly the question popped up, why do we need a Client Server setup at all?

Why don't the clients get their configuration directly from git?. This setup would have many advantages compared to the config server. (always running, failsafe, known address)

Could you explain why this is a good or bad idea, what features could the config server offer more then just to get the config from a repository?

vanilla test fails in JGitEnvironmentRepositoryTests in server

After cloning the repo, run the mvn clean install and got the following error:

org.junit.ComparisonFailure: expected:<...classes/config-repo/[]bar.properties> but was:<...classes/config-repo/[file:/private/var/folders/9k/2k7ntkvj14ncy7dg5nf42hj00000gn/T/config-repo-5075686710249411088/]bar.properties>

Adding repository.setBasedir(basedir); as the first line in the test makes it pass.

High availability for config server

What would high availability look like for the config server?
Consul is a cluster. Cassandra is highly available.
In aws would you run one per availability zone?

Just wanting to start a conversation, I know it doesn't need to be done for spring one.

Build issues with latest version

It fails for me on building with this error

[ERROR] Failed to execute goal on project spring-cloud-config-client: Could not resolve dependencies for project org.springframework.cloud:spring-cloud-config-client:jar:1.0.0.BUILD-SNAPSHOT: Failure to find org.springframework.security:spring-security-rsa:jar:1.0.0.M2 in https://repo.maven.apache.org/maven2 was cached in the local repository, resolution will not be reattempted until the update interval of central has elapsed or updates are forced -> [Help 1]

I noticed that you are building with this dependency

       <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-rsa</artifactId>
            <version>1.0.0.M2</version>
        </dependency>

I can't find that in any of the repos and when I looked at its location in github https://github.com/dsyer/spring-security-rsa, ieee that it was rolled back to snapshot.

What am I missing?

CLI app cannot switch off webEnvironment

$ spring run app.groovy -- --spring.main.webEnvironment=false --debug

output clearly shows that the Environment is a servlet one (even though the ApplicationContext is not).

Supporting multiple git repositories?

Instead of a single git repository, does Spring Cloud Config Server plan to support more than 1 git repository? If running Spring Cloud Config Server as a central config management server, it may have ownership concerns on having hundreds or thousands different application configurations in a single git repo.

Git SSH Deployment keys as alternative to username/password

username/password has the drawback that they a tied to a human or a technical user.
There is also the possibility to access the repository not only with username/password but also with ssh keys.
Does spring-cloud-config support ssh keys?

Maybe use multiple clones and stripe locks for access by multiple concurrent clients

In general the config server needs a separate clone, or a lock for each unique checkout. The checkout is unique per requested label, so the locking needs to be at least as granular as that. Actually it might even be worth sticking with one clone and locking the write operation for a different label than the current checkout. If all concurrent requests are for "master" for example, they can all make progress together from the same clone.

propagate profile info to spring-config clients

Hello
this might be a bit off topic as it is only directed to a cloud config client.

We have a zone where all microservices have one and the same profile (prod/te/dev) currently we start each microservice with spring.profiles.active and the url to the config server.
IMHO providing the spring.profiles.active for each microservice is redundant as it can be also retrieved from the config-server. So I would like to start only the config-server in the zone with an active profile such as (prod/te/dev) and this should be propagated to the config clients.

Regarding an implementation.

  1. Can a profile be changed at runtime in spring?
  2. Is there a way a calling client can pull the correct spring.profiles.active?
  3. Can a context refresh be performed automatically after the fetching from-config server. eg. config client starts with default profile gets the active profile from config server and activates this profile.

Add "Building" section to docs

Freshly cloned repo cannot be build:

$ mvn clean compile
[INFO] Scanning for projects...
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR]   The project org.springframework.cloud:spring-cloud-config:1.0.0.BUILD-SNAPSHOT (<path-to-repo>\spring-cloud-config\pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM: Could not find artifact org.springframework.cloud:spring-cloud-build:pom:1.0.0.BUILD-SNAPSHOT and 'parent.relativePath' points at no local POM @ line 11, column 10 -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException

Running ApplicationTests from IDEA results in an IllegalArgumentException

When running ApplicationTests individually from your IDE, the test fails because JGitEnvironmentRepository#copyFromLocalRepository does not recognize the path 'file:./target/test-classes/config-repo' as a file. This is primarily due to the IDE working directory when running tests defaults to the parent project. We can easily change the working directory in our Run configuration, but I thought if there was a better way to initialize the spring.cloud.config.server.git.uri property in the test it might make for smoother testing.

java.lang.IllegalArgumentException: Source File must denote a directory or file
    at org.springframework.util.Assert.isTrue(Assert.java:65)
    at org.springframework.util.FileSystemUtils.copyRecursively(FileSystemUtils.java:61)
    at org.springframework.cloud.config.server.JGitEnvironmentRepository.copyFromLocalRepository(JGitEnvironmentRepository.java:264)
    at org.springframework.cloud.config.server.JGitEnvironmentRepository.copyRepository(JGitEnvironmentRepository.java:249)
    at org.springframework.cloud.config.server.JGitEnvironmentRepository.createGitClient(JGitEnvironmentRepository.java:241)

image

Broken Travis build due to changes in asciidoctor generating scripts

After changes from the Simplify README generator commit the travis build stopped working.
It seems that preinstalled asciidoctor gem is missing.

mvn --settings .settings.xml install -P docs -q -U -DskipTests=true -Dmaven.test.redirectTestOutputToFile=true
Oct 14, 2014 4:13:31 PM org.apache.maven.wagon.providers.http.httpclient.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected: "[version: 0][name: rememberMe][value: deleteMe][domain: repository.jboss.org][path: /nexus][expiry: Tue Oct 14 16:13:31 UTC 2014]". Illegal path attribute "/nexus". Path of origin: "/maven2/org/jboss/weld/weld-parent/6/weld-parent-6.pom"
Oct 14, 2014 4:13:31 PM org.apache.maven.wagon.providers.http.httpclient.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected: "[version: 0][name: rememberMe][value: deleteMe][domain: repository.jboss.org][path: /nexus][expiry: Tue Oct 14 16:13:31 UTC 2014]". Illegal path attribute "/nexus". Path of origin: "/maven2/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.pom"
Oct 14, 2014 4:13:32 PM org.apache.maven.wagon.providers.http.httpclient.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected: "[version: 0][name: rememberMe][value: deleteMe][domain: repository.jboss.org][path: /nexus][expiry: Tue Oct 14 16:13:32 UTC 2014]". Illegal path attribute "/nexus". Path of origin: "/maven2/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.pom.sha1"
Oct 14, 2014 4:13:32 PM org.apache.maven.wagon.providers.http.httpclient.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected: "[version: 0][name: rememberMe][value: deleteMe][domain: repository.jboss.org][path: /nexus][expiry: Tue Oct 14 16:13:32 UTC 2014]". Illegal path attribute "/nexus". Path of origin: "/maven2/javax/inject/javax.inject/1/javax.inject-1.pom"
Oct 14, 2014 4:13:44 PM org.apache.maven.wagon.providers.http.httpclient.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected: "[version: 0][name: rememberMe][value: deleteMe][domain: repository.jboss.org][path: /nexus][expiry: Tue Oct 14 16:13:44 UTC 2014]". Illegal path attribute "/nexus". Path of origin: "/maven2/javax/inject/javax.inject/1/javax.inject-1.jar"
Oct 14, 2014 4:13:44 PM org.apache.maven.wagon.providers.http.httpclient.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected: "[version: 0][name: rememberMe][value: deleteMe][domain: repository.jboss.org][path: /nexus][expiry: Tue Oct 14 16:13:44 UTC 2014]". Illegal path attribute "/nexus". Path of origin: "/maven2/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar"
Oct 14, 2014 4:13:45 PM org.apache.maven.wagon.providers.http.httpclient.client.protocol.ResponseProcessCookies processCookies
WARNING: Cookie rejected: "[version: 0][name: rememberMe][value: deleteMe][domain: repository.jboss.org][path: /nexus][expiry: Tue Oct 14 16:13:45 UTC 2014]". Illegal path attribute "/nexus". Path of origin: "/maven2/javax/annotation/jsr250-api/1.0/jsr250-api-1.0.jar.sha1"
LoadError: no such file to load -- asciidoctor
  require at org/jruby/RubyKernel.java:1065
  require at file:/home/travis/.m2/repository/org/jruby/jruby-complete/1.7.12/jruby-complete-1.7.12.jar!/META-INF/jruby.home/lib/ruby/shared/rubygems/core_ext/kernel_require.rb:55
   (root) at /home/travis/build/spring-cloud/spring-cloud-config/docs/src/main/ruby/generate_readme.sh:5
Permissions.java:196:in `checkExit': org.apache.tools.ant.ExitException: Permission ("java.lang.RuntimePermission" "exitVM") was not granted.
    from Runtime.java:107:in `exit'
    from System.java:962:in `exit'
    from Main.java:199:in `main'
    from NativeMethodAccessorImpl.java:-2:in `invoke0'
    from NativeMethodAccessorImpl.java:57:in `invoke'
    from DelegatingMethodAccessorImpl.java:43:in `invoke'
    from Method.java:606:in `invoke'
    from ExecuteJava.java:217:in `run'
    from ExecuteJava.java:152:in `execute'
    from Java.java:771:in `run'
    from Java.java:221:in `executeJava'
    from Java.java:135:in `executeJava'
    from Java.java:108:in `execute'
    from UnknownElement.java:291:in `execute'
    from NativeMethodAccessorImpl.java:-2:in `invoke0'
    from NativeMethodAccessorImpl.java:57:in `invoke'
    from DelegatingMethodAccessorImpl.java:43:in `invoke'
    from Method.java:606:in `invoke'
    from DispatchUtils.java:106:in `execute'
    from Task.java:348:in `perform'
    from Target.java:390:in `execute'
    from Target.java:411:in `performTasks'
    from Project.java:1399:in `executeSortedTargets'
    from Project.java:1368:in `executeTarget'
    from AntRunMojo.java:327:in `execute'
    from DefaultBuildPluginManager.java:132:in `executeMojo'
    from MojoExecutor.java:208:in `execute'
    from MojoExecutor.java:153:in `execute'
    from MojoExecutor.java:145:in `execute'
    from LifecycleModuleBuilder.java:116:in `buildProject'
    from LifecycleModuleBuilder.java:80:in `buildProject'
    from SingleThreadedBuilder.java:51:in `build'
    from LifecycleStarter.java:120:in `execute'
    from DefaultMaven.java:347:in `doExecute'
    from DefaultMaven.java:154:in `execute'
    from MavenCli.java:582:in `execute'
    from MavenCli.java:214:in `doMain'
    from MavenCli.java:158:in `main'
    from NativeMethodAccessorImpl.java:-2:in `invoke0'
    from NativeMethodAccessorImpl.java:57:in `invoke'
    from DelegatingMethodAccessorImpl.java:43:in `invoke'
    from Method.java:606:in `invoke'
    from Launcher.java:289:in `launchEnhanced'
    from Launcher.java:229:in `launch'
    from Launcher.java:415:in `mainWithExitCode'
    from Launcher.java:356:in `main'
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-antrun-plugin:1.7:run (readme) on project spring-cloud-config-docs: An Ant BuildException has occured: Java returned: 1
[ERROR] around Ant part ...<java classname="org.jruby.Main" failonerror="yes">... @ 4:54 in /home/travis/build/spring-cloud/spring-cloud-config/docs/target/antrun/build-main.xml
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :spring-cloud-config-docs
travis_time:end:244795a4:start=1413303152337661355,finish=1413303257234615401,duration=104896954046
�[0K
�[31;1mThe command "mvn --settings .settings.xml install -P docs -q -U -DskipTests=true -Dmaven.test.redirectTestOutputToFile=true" failed and exited with 1 during .�[0m

Your build has been stopped.

@RefreshScope doesn't work on bean annotated with @Configuration

I am not sure the root cause is Spring Cloud Config, but since the @RefreshScope and refresh functionality is part of Spring Cloud Config, I thought I would start here. And perhaps this is expected behavior, but it was a surprise to me.

I basically followed the Spring Cloud Config tutorial here but was including the @Configuration annotation via the new @SpringBootApplication annotation. I was able to reproduce the issue by only adding a @Configuration annotation to the client's ClientApp class of the tutorial. GitHub for the tutorial is available here.

Working Client

@EnableAutoConfiguration
@ComponentScan
@RestController
@RefreshScope
public class ClientApp {
    @Value("${bar:World!}")
    String bar;

    @RequestMapping("/")
    String hello() {
        return "Hello " + bar + "!";
    }

    public static void main(String[] args) {
        SpringApplication.run(ClientApp.class, args);
    }
}

Not working client

@Configuration // **This is the only thing different!**
@EnableAutoConfiguration
@ComponentScan
@RestController
@RefreshScope
public class ClientApp {
    @Value("${bar:World!}")
    String bar;

    @RequestMapping("/")
    String hello() {
        return "Hello " + bar + "!";
    }

    public static void main(String[] args) {
        SpringApplication.run(ClientApp.class, args);
    }
}

Error
The following error is thrown after trying to access http://localhost:8080 following a refresh.

2014-11-25 00:03:56.487 ERROR 9868 --- [nio-8080-exec-7] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'scopedTarget.clientApp': Initialization of bean failed; nested exception is java.lang.NoSuchMethodError: demo.ClientApp.setBeanFactory(Lorg/springframework/beans/factory/BeanFactory;)V] with root cause

java.lang.NoSuchMethodError: demo.ClientApp.setBeanFactory(Lorg/springframework/beans/factory/BeanFactory;)V
    at demo.ClientApp$$EnhancerBySpringCGLIB$$9e153ad7.setBeanFactory(<generated>)
    at org.springframework.context.annotation.ConfigurationClassPostProcessor$EnhancedConfigurationBeanPostProcessor.postProcessPropertyValues(ConfigurationClassPostProcessor.java:448)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1185)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:475)
    at org.springframework.beans.factory.support.AbstractBeanFactory$2.getObject(AbstractBeanFactory.java:341)
    at org.springframework.cloud.context.scope.GenericScope$BeanLifecycleWrapper.getBean(GenericScope.java:447)
    at org.springframework.cloud.context.scope.GenericScope.get(GenericScope.java:181)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:336)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
    at org.springframework.aop.target.SimpleBeanTargetSource.getTarget(SimpleBeanTargetSource.java:35)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.getTarget(CglibAopProxy.java:676)
    at org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:627)
    at demo.ClientApp$$EnhancerBySpringCGLIB$$316d9b47.hello(<generated>)
...

Question
Is this expected behavior? This also happens with Spring Boot 1.2.0.RC2's new @SpringBootApplication annotation that includes the @Configuration annotation, which is how I originally ran into this issue. I suppose there is no need to annotate this class with the @Configuration annotation since it is not actually configuring anything, but that is often a default annotation that people put on their main Application class, as I believe is evidenced by the creation of the @SpringBootApplication annotation. I also suppose in an app with more substance, the Controller and/or beans containing @Value annotations would likely be separated out from the main class. Still, perhaps this is something to make more clear or fix.

Config server: fail fast when configuration source is not configured

If the source location of configuration data is not configured, config server defaults to using the github URI of a demo repo: https://github.com/spring-cloud/spring-cloud-config/blob/master/spring-cloud-config-server/src/main/java/org/springframework/cloud/config/server/JGitEnvironmentRepository.java#L62.

If a location source is not specified via one of the acceptable config options (e.g. spring.cloud.config.server.locations, spring.cloud.config.server.git.uri) then the config server should treat that as an error and make the error obvious to the user (possibly failing to start the app?).

consider splitting the cloud-config-client up a bit to allow alternate implementations

There are a lot of nice things about the cloud-config-client that would be applicable to anything that does configuration using a remote property source.

It looks like it should be possible to create an implementation of the PropertySourceLocator and with its .locate() method have it return a remotely-retrieved PropertySource.

The more generic pieces like the:

  • RefreshScope
  • EnvironmentManager

would be usable for lots of different implementations - for instance, a zookeeper based config store could implement things using watches on specific znodes and have it trigger the Refresh automatically (and indeed, this is what I'd be primarily working with this for)

It would be very nice if this config stuff could be set up so that someone could start out using one kind of provider (like a git-based one, which would be simple to set up and suitable for a certain number of applications) and then swap it out later to a different style configuration (such as a zookeeper based one) and not have to make changes to their code.

Enhancement: add option to organize configuration files under folders

In case one have 15-20 services, git repo for configuration service will end-up with 45-60 files all in root directory. It make sense to provide some simple convention for organizing files in folder per application. For example: if the configuration file is now {app}-{env}.yaml it may be expected in folder /{app}

spring.cloud.bootstrap.enabled=false causing NoSuchBeanDefinitionException

The config-server is not ment to bootstrap itself by fetching the configuration from localhost:8888. This makes sense because the server in question is being started. So for this reason I wanted to disable the bootstrap process for the config-server.

    public static void main(String[] args) throws IOException {
        System.setProperty("spring.cloud.bootstrap.enabled","false")
        run(Application.class, args)
    }

The error I get is this:

Dependency annotations: {}; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.cloud.config.client.RefreshEndpoint] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {}
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:561)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
    ... 16 common frames omitted

Documentation clarification

Just starting to play with this a little bit. I had a question in the documentation it says

$ curl localhost:8080/env
{
  "profiles":[],
  "configService:https://github.com/scratches/config-repo/bar.properties":{"foo":"bar"},
  "servletContextInitParams":{},
  "systemProperties":{...},
  ...
}

This for me gets a whitelabel error page on the sample project. /env/foo works as does /foo/env. Is this a typo in the docs or a problem with the code?

Support non-Boot client Spring applications

In its current form, Spring Cloud Config is only good for software projects starting now using Spring Boot that anticipate scaling up in the future. Existing Spring webapps that do not use Spring Boot (even those on Spring 4...) can't make use of Spring Cloud Config at all -- at least, not according to existing documentation.

Spring Boot and Spring Cloud Config seem aimed at two totally-disjoint user bases: Spring Boot is aimed at getting a small app up and running quickly, and allowing developers to build out enterprise-grade control later as they move further out and away from Boot's "automagic"; Spring Cloud Config is aimed at managing multiple large multi-environment enterprise-grade applications.

For anecdotal evidence: I work at a company looking to scale up our existing Spring 4 webapp (assembled without Boot), and would like to be able to use Spring Cloud Config for managing per-environment configuration of our app. But since Spring Boot is a prerequisite for Spring Cloud Config, the benefits of Cloud Config are unavailable to us unless we tear out all of our existing Spring context setup and hoping Boot "automagically" picks the right results in every case.

spring-cloud-config-server-1.0.0.M3 build doesn't work in Java 7

When running the config server using version 7 of the JRE, I received the following error.

java.lang.NoSuchMethodError: java.util.concurrent.ConcurrentHashMap.keySet()Ljava/util/concurrent/ConcurrentHashMap$KeySetView;
        at org.springframework.cloud.config.server.EncryptionController.decrypt(EncryptionController.java:215)
        at org.springframework.cloud.config.server.EnvironmentController.labelled(EnvironmentController.java:55)
        at org.springframework.cloud.config.server.EnvironmentController.labelledYaml(EnvironmentController.java:109)
        ...

The line in question is:

ConcurrentHashMap<Object, Object> map = new ConcurrentHashMap<Object, Object>(source.getSource());
for (Object key : map.keySet()) {  // **exception thrown here**
    String name = key.toString();

I'm guessing this is related to the Build-Jdk for the package being 1.8.0 and this Java compatability issue.

Add spring-cloud-config-server ability to share common configuration across applications

Right now it doesn't seem possible to share common configuration across applications. This might be a typical use case for certain types of configurations such as shared resources and system wide conventions. Perhaps it would be possible to add something conventional like a bootstrap.yml file for this purpose. Some ideas for naming here:

  • defaults.yml
  • base.yml
  • common.yml
  • shared.yml
  • application.yml

This could also support the label variants as well (e.g. application-development.yml, application-production.yml, etc.) The last one is particularly interesting because it is already a convention for Spring Boot. It seems to make sense in a system context as well.

Open to suggestions, but this is something that seems general enough to warrant some sort of support.

Broken Tests: EncryptionControllerTests

Broken tests including randomizedCipher(), formDataIn(), decryptEnvironment(), sunnyDaySymmetricKey(), sunnyDayRsaKey()

        @Test
    public void sunnyDayRsaKey() {
        controller.setEncryptor(new RsaSecretEncryptor());
        String cipher = controller.encrypt("foo", MediaType.TEXT_PLAIN);
        assertEquals("foo", controller.decrypt(cipher, MediaType.TEXT_PLAIN));
    }

breaks in encryptor.encrypt(data);

Produces:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x0000000052454979, pid=6304, tid=6840
#
# JRE version: Java(TM) SE Runtime Environment (7.0_67-b01) (build 1.7.0_67-b01)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.65-b04 mixed mode windows-amd64 compressed oops)
# Problematic frame:
# V  [jvm.dll+0x54979]
#
# Failed to write core dump. Minidumps are not enabled by default on client versions of Windows
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.sun.com/bugreport/crash.jsp
#

 ....

Broken Test: JGitEnvironmentRepositoryTests

JGitEnvironmentRepositoryTests failing;

root cause: org.eclipse.jgit.api.errors.JGitInternalException: Object c4bd92016dc14b9fe376d9c3f7af1c9d22d44ee4 is corrupt: bad stream

java.lang.IllegalStateException: Cannot load environment
    at org.springframework.cloud.config.server.JGitEnvironmentRepository.findOne(JGitEnvironmentRepository.java:161)
    at org.springframework.cloud.config.server.JGitEnvironmentRepositoryTests.nested(JGitEnvironmentRepositoryTests.java:66)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
    at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
    at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
    at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
    at org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
    at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
    at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
    at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
    at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
    at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
    at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
    at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
    at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
    at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
    at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: org.eclipse.jgit.api.errors.JGitInternalException: Object c4bd92016dc14b9fe376d9c3f7af1c9d22d44ee4 is corrupt: bad stream
    at org.eclipse.jgit.api.CheckoutCommand.call(CheckoutCommand.java:294)
    at org.springframework.cloud.config.server.JGitEnvironmentRepository.checkout(JGitEnvironmentRepository.java:208)
    at org.springframework.cloud.config.server.JGitEnvironmentRepository.loadEnvironment(JGitEnvironmentRepository.java:179)
    at org.springframework.cloud.config.server.JGitEnvironmentRepository.findOne(JGitEnvironmentRepository.java:155)
    ... 25 more
Caused by: org.eclipse.jgit.errors.CorruptObjectException: Object c4bd92016dc14b9fe376d9c3f7af1c9d22d44ee4 is corrupt: bad stream
    at org.eclipse.jgit.storage.file.UnpackedObject.open(UnpackedObject.java:189)
    at org.eclipse.jgit.storage.file.ObjectDirectory.openObject2(ObjectDirectory.java:537)
    at org.eclipse.jgit.storage.file.FileObjectDatabase.openObjectImpl2(FileObjectDatabase.java:198)
    at org.eclipse.jgit.storage.file.FileObjectDatabase.openObject(FileObjectDatabase.java:163)
    at org.eclipse.jgit.storage.file.WindowCursor.open(WindowCursor.java:123)
    at org.eclipse.jgit.lib.ObjectReader.open(ObjectReader.java:229)
    at org.eclipse.jgit.revwalk.RevWalk.parseAny(RevWalk.java:817)
    at org.eclipse.jgit.revwalk.RevWalk.parseCommit(RevWalk.java:730)
    at org.eclipse.jgit.api.CheckoutCommand.call(CheckoutCommand.java:229)
    ... 28 more

On decryption failure Spring context initialization should fail

In my opinion it would be better to throw exception in EnvironmentDecryptApplicationListener on decryption error rather than just clear property value. As a developer/devops I would like to get error immediately (context initialization failed, application is not available - red error in the monitoring system) rather than get an error a few hours/days later when the first database query is made or the first message is sent to the queue.

If you see practical use cases for just logging that error and clearing the value maybe it could be configurable, but IMHO by default it should fail immediately.

Question on Environment Changes

Hello,

When a change is pulled from the remote git repository do all services with the changed configuration get the changes automatically? Or do we need to call the /refresh or /restart endpoints on those services?

I made a change to the repository and the changes didn't get pulled until the next call for a configuration was made. That is fine, but when that happens do all other services get their configuration updated automatically? If not that is fine as well, we need to call the endpoints to have configuration updated - which works really well for rolling updates. If it does update services automatically, how can we disable that so that we can do rolling updates? Please let me know if you have any questions for me, thanks for the great work!

Invalid main class for spring-cloud-config-server

With changes b0c3642 (main function removed) and fdb6d0e (Application renamed) it's impossible to start server by mvn spring-boot:run:

Error: Could not find or load main class org.springframework.cloud.config.server.Application

or using spring-cloud-config-server-1.0.0.M1-exec.jar from milestone repo:

$ java -jar ./spring-cloud-config-server-1.0.0.M1-exec.jar
java.lang.ClassNotFoundException: org.springframework.cloud.config.server.Application

which stays in contradiction with all the documentation.

Configurable PropertySource priority (for property sources from config server)

I was wondering, if there is a possibility to configure the priority of the added "bootstrap"-proprtySource on client side. currently, it has highest priority, even higher than system-environment or startup-parameters. I would have thought that it should be after jvm parameters, just like normal application.properties. I actually reorder this propertySource via applicationInitializer. Is there a way to make this more easily configurable or even default?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.