Add support for volume mounted directories where the filename becomes
the property key and the file contents becomes the value.
Support is provided via a dedicated `VolumeMountDirectoryPropertySource`
class which can either be used directly, or via a "volumemount:/..."
`spring.config.import` location.
Closes gh-19990
Co-authored-by: Phillip Webb <pwebb@vmware.com>
Deprecate `ConfigFileApplicationListener` and provide a replacement
mechanism that supports arbitrary config data imports.
This commit updates the following areas:
- Extract `EnvironmentPostProcessor` invocation logic from the
`ConfigFileApplicationListener` to new dedicated listener. Also
providing support for `Log` injection.
- Extract `RandomPropertySource` adding logic from the
`ConfigFileApplicationListener` to a dedicated class.
- Migrate to the recently introduced `DefaultPropertiesPropertySource`
class when moving the defaultProperties `PropertySource`
- Replace processing logic with a phased approach to ensure that
profile enablement happens in a distinct phase and that profiles
can no longer be activated on an ad-hoc basis.
- Provide a more predictable and logical import order for processing
`application.properties` and `application.yml` files.
- Add support for a `spring.config.import` property which can be used
to import additional config data. Also provide a pluggable API
allowing third-parties to resolve and load locations themselves.
- Add `spring.config.activate.on-profile` support which replaces the
existing `spring.profiles` property.
- Add `spring.config.activate.on-cloud-platform` support which allows
a config data document to be active only on a given cloud platform.
- Support a `spring.config.use-legacy-processing` property allowing the
previous processing logic to be used.
Closes gh-22497
Co-authored-by: Madhura Bhave <mbhave@vmware.com>
Update `CloudPlatform` with a new `isEnforced` method that's backed
by a `Binder` rather than the `Environment`. We'll require this when
we overhaul our external config data processing logic.
Closes gh-22498
Extract `DefaultPropertiesPropertySource` from `SpringApplication` so
that logic can be easily accessed by other classes. Specifically the
property source name and logic to move the source to the end of the
list needs to be called from several places.
Closes gh-22520
Add a new `DeferredLogFactory` interface and `DeferredLogs`
implementation that can be used when a `DeferredLog` instance is needed
but the `switchOver` method should be handled elsewhere.
This interface has primarily been added so `EnvironmentPostProcessor`
classes will no longer need to implement `ApplicationEventListener`
just to switch over their logs.
Closes gh-22496
Update `OriginTrackedPropertiesLoader` so that it can support
multi-document properties files. These are similar to multi-document
YAML files but use `#---` as the separator.
Closes gh-22495
Co-authored-by: Phillip Webb <pwebb@vmware.com>
Update `OriginTrackedYamlLoader` so that empty documents are filtered
from the result. Prior to this commit, our origin wrapper would confuse
the YAML processor and cause empty documents to be included in the Map
with a key of "document" and no value.
Closes gh-22493
Update value object binder support so that parameters can be annotated
with `@Name` if a specific property name should be used. Prior to this
commit is was not possible to use Java reserved words as property names.
Closes gh-22492