EnvironmentChangeEvent should come before the RefreshScopeRefreshedEvent
so that all the @ConfigurationProperties are fully bound when the refresh
happens.
The main driver for this was a config server use case, where the server
wants to configure its own properties in the remote repo. It was working
up to a point, but the beans in bootstrap context were not refreshed
after the Environment was built so you had to manually refresh them to
get them to point to (e.g.) config repos configured remotely.
Fixes https://github.com/spring-cloud/spring-cloud-config/issues/139
The incoming (existing) environment needs to be used to initalize the
context that is created to grab the new environment, but we shouldn't
re-use the existing environment, rather just copy the property sources
and profiles.
If true (and spring.cloud.config.allowOverride=true) then the bootstrap
property source is added *last*, so all other property sources can override
it (including local config files).
Fixes gh-26, fixes gh-27.