On startup a bean will be bound by the
ConfigurationPropertiesBindingPostProcessor and then initialized
by the ApplicationContext. The ConfigurationPropertiesRebinder
does the binding but not the initialization (until this change).
Fixes gh-80
Since the bootstrap customizations are applied in ApplicationContextInitializers
they come too late to affect the logging levels. But the LoggingRebinder listener
isn't installed yet, and the context is not ready for events to be published. So
to get the logging changes in as early as possible we actually need to explicitly
apply them in the property source initializer as soon as the remote properties are
available.
Fixes gh-74, fixes gh-75
In the server we use a SpringApplicationEnvironmentRepository to load
the YAML and properties files from git (or locally). It creates a mini
SpringApplication so as to faithfully replicate the way the Environment
is created. Unfortunately that can have side effects on the server
application itself (e.g. setting log levels). In particular if the
mini SpringApplication fails to start then the log levels could be
left in a "preInitialized" state with all log levels OFF by default.
This change ensures that the server logs all errors when loading YAML
and properties files, and also that the client logs the error response
if it is JSON (as it should be).
Fixes gh-66, fixes gh-67
The default behaviour is the same as before, so a config client
adds the remote property sources "first" (i.e. ahead of system
properties). If the user sets up a remote config repo with
spring.cloud.config.overrideSystemProperties=false they can
change this behaviour and insert the new property source after
systemEnvironment (i.e. before local config files but after the
other local sources). Of course using an `application.yml` on
the server you can change the default for all applications.
There is also a new feature in the config server where the operator
can add a map of override properties in
spring.cloud.config.server.overrides.* and have them added with
highest priority in the Environment returned from the server.
Using that the operator can prevent config repositories from
changing the override behaviour by setting
spring.cloud.config.allowOverride=false.
Fixes gh-57
There are still some problematic areas (see SPR-12486) where users
might be surprised, but at least there now is an error message for the
specific case of @RefreshScope on @Configuration.
Fixes gh-43
Fixes gh-44 because it allows an extra layer to insert
an @AutoConfigureAfter.
Also adds some more integration tests for refresh scope
Per gh-43, note that @Configuration does not play well
with @RefreshScope (see @Ignored test case).
The problem was the ordering of ApplicationContextInitializers:
the bootstrap process sets the parent application context in an
initializer (formerly with no @Order) which needs to happen
before any other initializers that depend on the Environment.
Fix is to add an @Order (e.g. 0) so it comes before the
ContextIdApplicationContextInitializer.
Fixes gh-37
On the server we choose not to fail if a property cannot be decrypted (clients
might be relying on the other values to be able to deal with the failure).
Fixes gh-31
All @RefreshScope beans should be invalidated even if there
are no changes in property values (since those might have come from
a POST to /env for instance).