Commit Graph

2214 Commits

Author SHA1 Message Date
Phillip Webb 5b836f3aee Merge branch '2.3.x' into 2.4.x
Closes gh-26124
2021-04-14 17:42:38 -07:00
Phillip Webb 61ff3c98bf Polish 'Don't detect CloudPlatform when property is set'
See gh-25455
2021-04-14 17:29:30 -07:00
nguyensach 70f44d3a56 Don't detect CloudPlatform when property is set
Update `CloudPlatform.isActive` to back-off from detection when any
`spring.main.cloud-platform` property is set.

See gh-25455
2021-04-14 17:24:37 -07:00
Stephane Nicoll f1b2db03e0 Start building against Spring Framework 5.3.6 snapshots
See gh-25909
2021-04-08 18:02:03 +02:00
Brian Clozel a0ee0601ef Fix SSL configuration with Reactor Netty
Prior to this commit, the SslServerCustomizer would use a Reactor Netty
API that lets users customize the SSL configuration, but later override
some of the choices with defaults.

This commits moves from the new deprecated Reactor Netty API and instead
uses a new variant that builds the defaults and lets developers override
them if they want to.

Fixes gh-25913
2021-04-08 17:09:31 +02:00
Stephane Nicoll c6205f10f1 Merge branch '2.3.x' into 2.4.x
Closes gh-25922
2021-04-08 10:13:45 +02:00
Stephane Nicoll 25b7495d8e Polish "Properly close input streams when loading key stores"
See gh-25884
2021-04-08 09:25:03 +02:00
Alex Belyaev 1e3f5c342b Properly close input streams when loading key stores
See gh-25884
2021-04-08 09:21:58 +02:00
Phillip Webb 8a04547454 Fix checkstyle violation
See gh-25766
2021-04-05 18:18:52 -07:00
Phillip Webb 5774ea3f0c Support profile specific ConfigData imports
Update the `ConfigData` import support to allow individual property
sources to be imported with a higher precedence than profile specific
imports.

Prior to this commit, imported sources would always have a higher
precedence than the file that imported them, but a lower precedence
than any profile-specific variant of the same file.

For example, given an `application.properties` that imports `myconfig`,
the contributor tree would be as follows:

	ROOT
	 +- `application.properties`
	 |    +- myconfig
	 +- `application-<profile>.properties`

The precedence would be:

	1) `application-<profile>.properties`
	2) myconfig
	3) `application.properties`

This works well for most situations, but can be confusing if import is
for a profile-specific property source. For example:

	ROOT
	 +- `application.properties`
	 |    +- myconfig
	 |    +- myconfig-<profile>
	 +- `application-<profile>.properties`

Results in the order precedence of:

	1) `application-<profile>.properties`
	2) myconfig-<profile>
	3) myconfig
	4) `application.properties`

This means that whilst `myconfig` overrides `application.properties`,
`myconfig-profile` does not override `application-<profile>.properties`.

For this specific situation, the preferable order would be:

	1) myconfig-<profile>
	2) `application-<profile>.properties`
	3) myconfig
	4) `application.properties`

To support this alternative ordering a new `PROFILE_SPECIFIC` config
data option has been added. Additionally, options may now be specified
on a per-source basis by using the `PropertySourceOptions` interface.

Fixes gh-25766
2021-04-05 15:55:03 -07:00
Stephane Nicoll db3dfffdca Polish contribution
See gh-25875
2021-04-04 11:15:49 +02:00
izeye 852e5778a3 Polish
See gh-25875
2021-04-04 11:12:03 +02:00
Andy Wilkinson 38a4f135a9 Merge branch '2.3.x' into 2.4.x
Closes gh-25836
2021-03-30 20:42:29 +01:00
Andy Wilkinson ca9a619259 Defer processing of zipTree source until execution time
Closes gh-25835
2021-03-30 20:41:46 +01:00
Phillip Webb a28a3ae090 Merge branch '2.3.x' into 2.4.x 2021-03-30 09:25:46 -07:00
Phillip Webb 9c8a97809d Consistent use of @deprecated since
Restore the patch version number for consistency with `@since`
tags.

See gh-25808
2021-03-30 09:20:30 -07:00
Phillip Webb 363f5829d1 Merge branch '2.3.x' into 2.4.x
Closes gh-25825
2021-03-29 15:46:50 -07:00
Phillip Webb 26dd1b9a26 Update deprecations with for removal targets
Update all deprecation tags to include a removal target.

Closes gh-25808
2021-03-29 15:44:58 -07:00
Phillip Webb 35aeae5a4f Deprecate Bootstrapper
Deprecate the `Bootstrapper` interface entirely and provide a
`BootstrapRegistryInitializer` alternative so that people can migrate.

Unfortunately our previous attempt to fix the typo in the `Bootstrapper`
interface didn't provide us a way to remove the deprecated method
without impacting users. It was also problematic for people who were
implementing `Bootstrapper` rather than using a lambda since they needed
to introduce the deprecated method.

We unfortunately can't see a way to fix the original typo without
introducing a new interface.

Fixes gh-25735
2021-03-24 14:10:12 -07:00
Phillip Webb 9af6c895c9 Merge branch '2.3.x' into 2.4.x 2021-03-23 13:09:25 -07:00
Phillip Webb 2b591387b8 Restore tomcat-embed TldPatterns
Restore tomcat-embed-core-* and tomcat-embed-logging-* patterns which
were inadvertently removed in commit 0ec8d281ef.

See gh-25764
2021-03-23 13:07:15 -07:00
Phillip Webb 11a94ee6f0 Merge branch '2.3.x' into 2.4.x 2021-03-23 12:52:07 -07:00
Phillip Webb 82127fdaa3 Update copyright year of changed files 2021-03-23 12:50:49 -07:00
Phillip Webb 56674b9031 Merge branch '2.3.x' into 2.4.x
Closes gh-25770
2021-03-23 12:48:51 -07:00
Phillip Webb 0ec8d281ef Align TldPatterns with Tomcat default
Update `TldPatterns` to align with the latest default shipped by Tomcat.
This commit also introduces a test to ensure that we will remain aligned
going forwards.

Closes gh-25764
2021-03-23 12:46:27 -07:00
Andy Wilkinson 33cf8b3bc4 Merge branch '2.3.x' into 2.4.x
Closes gh-25765
2021-03-23 13:06:35 +00:00
Andy Wilkinson bf6f36a783 Apply any root URI to RestTemplate metric's URI tag
Previously, a root URI configured via RestTemplateBuilder's rootUri
method and RootUriTemplateHandler was not taken into account when
generated the URI tag for RestTemplate request metrics.

This commit updates MetricsClientHttpRequestInterceptor to be aware
of RootUriTemplateHandler and capture the URI template once the
root URI has been applied.

Fixes gh-25744
2021-03-23 13:05:54 +00:00
Andy Wilkinson 226ee61dea Create exception reporters when needed so they pick up current state
Fixes gh-25691
2021-03-16 16:13:40 +00:00
Madhura Bhave 11649bc1f0 Merge branch '2.3.x' into 2.4.x
Closes gh-25614
2021-03-12 14:02:34 -08:00
Madhura Bhave df1d1dbaa9 Fallback to BeanPropertyBindingResult for unbound property validation
gh-17424 updated `ValidationBindHandler` so that it would
only look at bound values when validating. This commit updates
`ValidationBindHandler` to use Spring Framework's `BeanPropertyBindingResult`.
This means that for fields that are not bound, JavaBean accessor methods can
be used to get the value to validate.

Fixes gh-25356
2021-03-12 13:56:54 -08:00
Johnny Lim 90666faf6d Add Javadoc since tag to Bootstrapper.initialize()
See gh-25596
2021-03-11 09:34:57 +00:00
Andy Wilkinson f9ef05f71e Polish "Add Bootstrapper initialize method to fix typo"
See gh-25400
2021-03-05 15:06:51 +00:00
cprayer bee6f41393 Add Bootstrapper initialize method to fix typo
See gh-25400
2021-03-05 15:06:50 +00:00
dreis2211 89a44f3da4 Fix some assertions
See gh-25499
2021-03-05 09:56:55 +01:00
Madhura Bhave 181d0ee932 Merge default property sources
Fixes gh-25408
2021-03-04 09:46:00 -08:00
Stephane Nicoll 526474f3b8 Add username alias for Postgres's PGSimpleDataSource
Closes gh-25363
2021-02-18 14:07:05 +01:00
Madhura Bhave 00a358b4d3 Throw or warn for invalid config properties with list syntax
Fixes gh-25309
2021-02-17 12:45:37 -08:00
Stephane Nicoll 5d1bb3025b Add username alias for H2's JdbcDataSource
Closes gh-25263
2021-02-17 17:40:34 +01:00
Stephane Nicoll f6b5964258 Merge branch '2.3.x' into 2.4.x
Closes gh-25312
2021-02-16 13:50:55 +01:00
Stephane Nicoll 0da7822e27 Update copyright of changed files
See gh-25265
2021-02-16 13:50:15 +01:00
melburne 2163c96205 Fix incorrect detection of Amazon Redshift
See gh-25265
2021-02-16 13:50:15 +01:00
Andy Wilkinson 55e3ca66e2 Replace native image system property with call to NativeDetector
Closes gh-25303
2021-02-16 10:34:34 +00:00
Andy Wilkinson 392be57003 Apply Logback system properties and not just common properties to context
Closes gh-24894
2021-02-12 14:34:31 +00:00
izeye 63ee99bf75 Polish
See gh-25093
2021-02-09 09:48:35 +01:00
Andy Wilkinson 788a42d694 Merge branch '2.3.x' into 2.4.x
See gh-25076
2021-02-02 15:12:27 +00:00
Andy Wilkinson 67479b6380 Add junit-platform-launcher dependency by convention
Closes gh-25074
2021-02-02 13:03:21 +00:00
Phillip Webb 230b4ab2eb Merge branch '2.3.x' into 2.4.x 2021-02-01 22:10:52 -08:00
Phillip Webb 77478d9f34 Refine CharSequenceToObjectConverter logic
Update `CharSequenceToObjectConverter` so that conversion that would
apply using an `ObjectTo...` converter now favors `toString()` based
conversion.

Prior to this commit, when converting a `CharSequence` to a `Collection`
the `ObjectToCollectionConveter` would be picked instead of the
`StringToCollectionConverter`. This resulted in a `Collection`
containing a single `String` value, rather than the expected list
of values split around ",".

Fixes gh-25057
2021-01-30 12:35:36 -08:00
Phillip Webb dd997cda9c Remove sysout from test 2021-01-30 10:38:02 -08:00
Phillip Webb 0fcc52ccaf Protect against NPE with Option.IGNORE_IMPORTS
Update `ConfigDataEnvironmentContributor` to deal with the fact that
the `properties` instance can be `null`.

Fixes gh-25029
2021-01-27 14:17:41 -08:00
Phillip Webb 7f32fa6723 Allow 'on-profile' in profile specific files
Restore the ability to use `spring.config.activate.on-profile` or
`spring.profiles` in profile specific files.

Closes gh-24990
2021-01-27 14:07:02 -08:00
Phillip Webb 1def245a2c Support DeferredLogFactory injection
Update `ConfigDataLoader` and `ConfigDataLocationResolver` to support
`DeferredLogFactory` injection.

Closes gh-24988
2021-01-25 23:13:01 -08:00
Andy Wilkinson 5362633014 Merge branch '2.3.x' into 2.4.x
Closes gh-24973
2021-01-22 13:32:30 +00:00
Andy Wilkinson 0b06ac9938 Use AssertJ's doesNotContainKey
Closes gh-24970
2021-01-22 13:28:41 +00:00
Phillip Webb 80dbbaf012 Add ConfigData IGNORE_PROFILES support
Add a new `ConfigData.Option` that allows profile properties to be
ignored. This update will allow Spring Cloud Config Server to provide
`ConfigData` that only has profile properties processed on the
server-side.

Closes gh-24890
2021-01-19 18:13:24 -08:00
dreis2211 b8b5e4cebf Fix configuration metadata for logging.charset.* properties
See gh-24851
2021-01-17 17:02:24 +01:00
Stephane Nicoll e8ae18ae11 Polish
See gh-24837
2021-01-15 14:36:53 +01:00
Stephane Nicoll 9343633582 Merge branch '2.3.x' into 2.4.x 2021-01-15 08:25:27 +01:00
Stephane Nicoll 9a53865c8f Polish 2021-01-15 08:24:57 +01:00
Phillip Webb 26f2caca22 Update copyright year of changed files 2021-01-14 17:25:09 -08:00
Phillip Webb c0aef4c35f Apply SystemProperties to LoggerContext
Update `LoggingSystemProperties` so that system environment properties
are also applied to the `LoggerContext`. This is required when multiple
applications are deployed to the same Servlet container. In such setups
there's only a single JVM and the System Environment can be changed
when multiple applications start at the same time.

Fixes gh-24835
2021-01-14 17:22:37 -08:00
Madhura Bhave 68fc2329c8 Revert "Remove unnecessary code"
Fixes gh-24835
2021-01-14 16:13:30 -08:00
Stephane Nicoll 2072e7242a Merge branch '2.3.x' into 2.4.x
Closes gh-24841
2021-01-14 18:02:28 +01:00
Stephane Nicoll 283ed48d63 Unwrap Datasource against an actual interface
This commit updates DataSourceUnwrapper to take a separate interface
type argument if the target datasource has to be unwrapped, given that
the target type is usually not an interface.

Closes gh-24697
2021-01-14 18:00:35 +01:00
Stephane Nicoll 5d85ac6838 Complete configuration metadata for spring.config.*
Closes gh-24816
2021-01-14 10:54:51 +01:00
Madhura Bhave ceff47afba Fix ordering of properties and yaml files
Fixes gh-24719
2021-01-13 15:17:12 -08:00
Phillip Webb a6a7c06e55 Merge branch '2.3.x' into 2.4.x 2021-01-12 12:04:11 -08:00
Phillip Webb b6cb9c016f Detect bad properties in profile specific files
Throw an `InvalidConfigDataPropertyException` if bad properties are
detected in profile specific files. The following properties will now
trigger an exception if used in a profile specific file:

	`spring.profiles.include`
	`spring.profiles.active`
	`spring.profiles.default`
	`spring.config.activate.on-profile`
	`spring.profiles`

Prior to this commit, profile based properties in a profile specific
file would be silently ignored, making them hard to find.

Fixes gh-24733
2021-01-12 11:48:19 -08:00
Madhura Bhave 5ed2b11e34 Fix typo 2021-01-12 10:59:59 -08:00
Phillip Webb 039df1d96d Test spring.profiles.include in profile file
Add a test to ensure that `spring.profiles.include` is not silently
ignored when used in a profile-specific file.

See gh-24733
2021-01-11 12:04:14 -08:00
Phillip Webb 26a68ca2cf Polish 2021-01-11 12:04:07 -08:00
asheCarry 17c0c7d9d6 Fix javadoc typo in ConfigDataLocation
See gh-24660
2021-01-06 17:39:39 -08:00
Phillip Webb 48661e79f5 Merge branch '2.3.x' into 2.4.x
Closes gh-24683
2021-01-06 17:30:55 -08:00
Phillip Webb 7cbd57b635 Log FailureAnalyzer errors at trace level
Update `FailureAnalyzers` to log errors at `trace` rather than `debug`.
This should reduce noise when an analyzer unexpectedly fails and the
user is running with `--debug`.

Fixes gh-24630
2021-01-06 17:29:24 -08:00
Phillip Webb 5b126b01c0 Replace binder as contributors are processed
Update `ConfigDataEnvironment` so that the bootstrap `Binder` is
replaced as contributors are processed. The final `Binder` is now
also added without the `FAIL_ON_BIND_TO_INACTIVE_SOURCE` option so
that properties can be bound at the last stage even if values exist
in an inactive profile-specific document.

Closes gh-24669
2021-01-06 13:31:29 -08:00
Phillip Webb c9f9246c59 Merge branch '2.3.x' into 2.4.x
Closes gh-24657
2021-01-05 16:03:01 -08:00
Phillip Webb 9b9c3edfcd Polish "Return -1 port for non-listening WebServers"
See gh-24606
2021-01-05 16:02:26 -08:00
Stefan Partusch 5c61df3131 Return -1 port for non-listening WebServers
Update `WebServer` implementations to return -1 from `getPort()` if
the server  isn't listening on a port. This aligns the implementations
with the interface Javadoc.

See gh-24606
2021-01-05 15:56:25 -08:00
Scott Frederick 505340909a Support symlinks in configtree property paths
Prior to this commit, the configtree property source would not traverse
into a sub-directory in a property path if the sub-directory was a
symbolic link. This commit allows symlinked sub-directories to be
traversed like any other sub-directory in the property path.

Fixes gh-24530
2021-01-05 14:04:59 -06:00
Madhura Bhave 615a8ae56e Ignore documents that do not apply when checking mandatory locations
Closes gh-24584
2021-01-05 10:47:06 -08:00
Stephane Nicoll 1bc1258341 Polish "Make a field final"
See gh-24629
2021-01-03 17:58:46 +01:00
Andrey Kolchanov 0e3990931e Make a field final
See gh-24629
2021-01-03 17:58:14 +01:00
izeye 5e3f618f9d Polish
See gh-24604
2020-12-23 16:08:21 +01:00
dreis2211 f9fbadb8d9 Add JavaVersion entry for JDK 16
See gh-24453
2020-12-21 09:59:52 +01:00
Phillip Webb 5317d8a9bb Change scope of bootstrap registered Binder
Update `ConfigDataEnvironment` so that the `Binder` is registered as
a prototype bootstrap instance. This allows it to be accessed early
but still replaced when a more complete version is available.

Fixes gh-24559
2020-12-18 15:16:11 -08:00
Phillip Webb e1b158ec66 Add BootstrapRegistry Scope support
Update `BootstrapRegistry` so that it can be used to register instances
in either a `singleton` or `prototype` scope. The prototype scope has
been added so that instances can be registered and replaced later
if needed.

See gh-24559
2020-12-18 15:14:04 -08:00
Andy Wilkinson e083be7de1 Fix ConfigDataEnvironmentPostProcessorIntegrationTests in Windows 2020-12-18 15:26:03 +00:00
Phillip Webb 5ca01ce5a8 Make StandardConfigDataResource.getResource public
Update `StandardConfigDataResource`  to make the `getResource()` method
public so that it can be used by Spring Cloud.

Closes gh-24504
2020-12-16 16:49:39 -08:00
Phillip Webb d195815488 Only throw PortInUseException if port is set
Refine the `PortInUseException` logic in `NettyWebServer` to only throw
an exception if the port is set. The prevents a misleading exception
from being thrown when a domain socket is being used.

Closes gh-24529
2020-12-16 16:45:16 -08:00
Phillip Webb 7fd4c53352 Deal with unsupported DisposableServer operations
Update `NettyWebServer` to deal with any `UnsupportedOperationException`
thrown from `DisposableServer`. Specifically, this commit allows the
`NettyWebServer` to work with domain socket backed servers which cannot
provide a port.

Fixes gh-24529
2020-12-16 15:29:54 -08:00
Phillip Webb 38e4c2a179 Add ConfigDataEnvironmentUpdateListener support
Add an overloaded `ConfigDataEnvironmentPostProcessor.applyTo` method
that accepts a listener that can used to track the updates that were
applied to the `Environment`.

The listener can be used to track the which `ConfigDataLocation` and
the `ConfigDataResource` were used to add a `PropertySource`. The lister
can also be used to tell which profiles were applied.

This enhancement is being added in a patch release because it's will
be useful for Spring Cloud 2020.0.0.

Closes gh-24504
2020-12-15 19:52:20 -08:00
Phillip Webb 5e1a69e90e Polish 2020-12-15 19:51:53 -08:00
Phillip Webb 4fba7d0c60 Merge branch '2.3.x' into 2.4.x 2020-12-15 19:48:52 -08:00
Phillip Webb 29300530c6 Polish 2020-12-15 19:44:40 -08:00
Phillip Webb a2d0b64e9c Test that empty property files can be used
Add an additional test to ensure that empty property files do not
throw ConfigDataLocationNotFoundException exceptions.

See gh-24499
See gh-24515
2020-12-15 11:10:07 -08:00
izeye 8e69a821d5 Use BindResult.orElseGet() where beneficial
See gh-24477
2020-12-15 11:26:15 +01:00
Phillip Webb d1f2aab1e8 Fix non-optional classpath location checking
Allow directory locations that exist but do not contribute properties
to be specified without an `optional:` prefix. This commit fixes logic
introduced in commit 3dc03ac275 which didn't account for the fact that
a directory might contain only profile specific property files and that
profiles might not always be active.

Closes gh-24499
2020-12-14 20:32:13 -08:00
Phillip Webb 72d36e0c07 Update copyright year of changed files 2020-12-10 10:46:04 -08:00
Phillip Webb 14816a6b6c Support @Name meta-annotations with Kotlin binding
Update `ValueObjectBinder` Kotlin support to meta-annotations of
`@Named`.

See gh-24379
2020-12-10 10:44:15 -08:00
Andy Wilkinson 32e1289bbc Use unique names for wildcard property sources
Update `StandardConfigDataLoader` to use unique names for property
sources imported from a wildcard location.

Prior to this commit, all the property sources created from the same
wildcard location would have the same name. Each time a property source
that is equal to an existing property source is added, it replaces the
existing property source. Property source equality is name-based so this
resulted in the last property sources from the wildcard location
winning.

This commit updates `StandardConfigDataLoader` to use the resolved
Resource rather than the wildcard location in which it was discovered
in the name of the property source that it creates, ensuring that each
is property source from a wildcard location is uniquely named.

Fixes gh-24428
2020-12-10 10:43:34 -08:00