Commit Graph

2214 Commits

Author SHA1 Message Date
Phillip Webb 112503058a Merge branch '2.3.x'
Closes gh-24425
2020-12-09 18:24:22 -08:00
Phillip Webb 0bfa9cf107 Merge branch '2.2.x' into 2.3.x
Closes gh-24424
2020-12-09 18:19:28 -08:00
Phillip Webb 869141766b Use deterministic ordering of JavaBean methods
Update `JavaBeanBinder` so that methods and fields are sorted before
being processed. This ensures that setters are called in a deterministic
order, rather than the unspecified and variable order that reflection
provides.

Fixes gh-24068
2020-12-09 18:19:07 -08:00
Phillip Webb bef5fe29e3 Allow recursive profile group references
Update the original fix for issue #24327 so that recursive elements
are tolerated rather than fail.

See gh-24327
2020-12-08 18:58:05 -08:00
Phillip Webb 0931f04eb0 Polish 'Fail on recursive references in profile groups'
See gh-24327
2020-12-08 18:13:57 -08:00
dreis2211 5b74f77ac6 Fail on recursive references in profile groups
Update `Profiles` group expansion logic to fail if recursive
references are found.

See gh-24327
2020-12-08 18:13:56 -08:00
Scott Frederick d61724aada Add @Name support for Kotlin value object binding
Fixes gh-24379
2020-12-07 18:51:42 -06:00
Phillip Webb 30c27274e2 Merge branch '2.3.x'
Closes gh-24339
2020-12-04 18:31:55 -08:00
Phillip Webb 5f351a6983 Merge branch '2.2.x' into 2.3.x
Closes gh-24338
2020-12-04 18:21:57 -08:00
Phillip Webb 837fc83527 Fix checkstyle header violations
See gh-24337
2020-12-04 18:05:53 -08:00
Madhura Bhave 932fb65107 Correct external application properties load order
Fixes gh-24308
2020-12-03 11:55:51 -08:00
Phillip Webb 3dc03ac275 Refine non-optional classpath location checking
Update `StandardConfigDataLocationResolver` to no longer check if
directories exist for classpath resources. Unfortunately checking for
the parent directory of a `ClassPathResource` isn't always possible
without resorting something similar to the
`PathMatchingResourcePatternResolver` which would add a lot of
complexity to the resolver.

In order to ensure that non-optional locations are always resolved,
the `ConfigDataEnvironment` now checks that all imported locations
have been loaded.

Closes gh-24143
2020-12-01 21:33:59 -08:00
Jim Stockwell 728e474f7f Mark OriginTrackedPropertiesLoader#isNewDocument private
See gh-24268
2020-11-27 09:16:01 +01:00
Stephane Nicoll e6ccbfb017 Merge branch '2.3.x'
Closes gh-24259
2020-11-26 09:02:33 +01:00
Jim Stockwell bb7ad30de4 Fix ErrorAttributeOptions#getIncludes Javadoc
See gh-24257
2020-11-26 09:00:52 +01:00
João Guerra 1d6bacf1c8 Fix typo
See gh-24245
2020-11-25 14:57:14 +01:00
Stephane Nicoll 8bcc3d1b09 Merge branch '2.3.x'
Closes gh-24234
2020-11-23 20:51:58 +01:00
Stephane Nicoll 016b69aa78 Polish "Allow to exclude an empty set of ErrorAttributes"
See gh-24230
2020-11-23 20:44:18 +01:00
Wanderlei Souza 6518f8f7fd Allow to exclude an empty set of ErrorAttributes
See gh-24230
2020-11-23 20:43:59 +01:00
Madhura Bhave e342d7d262 Fix processing of line immediately after # in properties file
Fixes gh-24158
2020-11-18 11:33:37 -08:00
Andy Wilkinson 15c44aa45f Merge branch '2.3.x'
Closes gh-24200
2020-11-18 12:04:29 +00:00
Andy Wilkinson 988526bee9 Only attempt unwrapping of interfaces
Wrapper's isWrapperFor and unwrap methods both take a Class<?> target
but document that the target should be an interface. Prior to this
change, we were calling isWrapperFor with any Class<?> irrespective of
whether or not it was an interface. When using Oracle UCP each call
to isWrapperFor with an interface results in an exception stack trace
being logged.

This commit upates DataSourceUnwrapper to adhere to Wrapper's contract
by only calling isWrapperFor and unwrap with interfaces.

Fixes gh-24154
2020-11-18 11:35:11 +00:00
Phillip Webb 0ce3e7ec6b Protect against NPE caused by recursive calls
Update `SpringBootConfigurationFactory` so that it no longer attempts
to get a `LoggingSystem`.

The recent `LoggingSystem` update means makes use of the
`SpringFactoriesLoader` class to load candidate logging systems.
Unfortunately, the `SpringFactoriesLoader` class creates a `Logger`
which (when using Log4J2) causes `SpringBootConfigurationFactory` to
run. Calling `LoggingSystem.get` from `SpringBootConfigurationFactory`
results in a recursive call to `SpringFactoriesLoader` which hasn't
yet been fully initialized. We then see an NPE caused by a `null`
`cache`.

This update removes the call to `LoggingSystem.get` with the assumption
that it would never return `null` anyway.

Fixes gh-24163
2020-11-17 17:24:14 -08:00
Phillip Webb e8244d8d70 Add CharSequenceToObjectConverter support
Update `ApplicationConversionService` with support for converting
`CharSequence` source types by using existing `String` based converters.

The addition is primarily to allow `ConfigTreePropertySource` values
to be converted correctly.

Closes gh-24171
2020-11-17 13:19:10 -08:00
Andy Wilkinson 795100f27d Merge branch '2.3.x'
See gh-24043
2020-11-11 15:39:23 +00:00
Andy Wilkinson 4a630dc7a9 Only skip ..-prefixed locations when found via wildcard
Closes gh-23983
2020-11-11 15:36:39 +00:00
Andy Wilkinson ce8427793f Merge branch '2.3.x'
See gh-24053
2020-11-05 12:19:44 +00:00
Andy Wilkinson 91f4541a91 Merge branch '2.2.x' into 2.3.x
See gh-24052
2020-11-05 12:19:13 +00:00
Andy Wilkinson 006d4bc36d Do not set Tomcat's trust store password when null
See gh-24041
2020-11-05 12:18:32 +00:00
Andy Wilkinson 06f37f4295 Merge branch '2.3.x'
Closes gh-24053
2020-11-05 11:40:07 +00:00
Andy Wilkinson 2ffb81f0d9 Merge branch '2.2.x' into 2.3.x
Closes gh-24052
2020-11-05 11:35:37 +00:00
Andy Wilkinson 2425dcd200 Do not set Tomcat's key store and key pass when null
Fixes gh-24041
2020-11-05 11:30:04 +00:00
Scott Frederick 8f39ebf781 Merge branch '2.3.x'
Closes gh-24043
2020-11-04 16:53:57 -06:00
Scott Frederick 62aa1b7aaf Narrow criteria for hidden property paths
A previous change intended to prevent temporary directories created as
an implementation detail of mounting volumes on kubernetes pods from
being used as a source for property files had a side-effect of also
preventing other types of hidden directories from being recognized. This
commit narrows the criteria for considering a directory as hidden,
using the kubernetes `..` prefix convention instead of the Unix `.`
prefix.

Fixes gh-23983
2020-11-04 16:09:54 -06:00
Andy Wilkinson 4c777c6df7 Deprecate classpath logging listener and stop registering by default
Closes gh-23138
2020-11-03 17:21:36 +00:00
Andy Wilkinson c722692a8b Polish "Align MustacheViewResolver with other similar resolvers"
See gh-24011
2020-11-03 14:28:11 +00:00
Dave Syer 22693c17f3 Align MustacheViewResolver with other similar resolvers
The `FreeMarkerViewResolver` (and other template-based resolvers) in
Spring Framework avoid using reflection if they know how to
instantiate the view class. This change aligns with them.

See gh-24011
2020-11-03 14:21:50 +00:00
Andy Wilkinson 699f03d5a6 Merge branch '2.3.x'
Closes gh-24010
2020-11-03 14:04:38 +00:00
Andy Wilkinson 2dce4aa42b Merge branch '2.2.x' into 2.3.x
Closes gh-24009
2020-11-03 14:04:08 +00:00
Andy Wilkinson 30a0ccab02 Remove use of `@PostConstruct` from main code
When running on Java 11 (where `@PostConstruct` is no longer part of
the JRE) and without a dependency on jakarta-annotation-api,
`@PostContruct` annotions are silently dropped. This leads to obscure and
hard-to-track down changes in the behaviour of our auto-configuration
as the `@PostConstruct`-annotated methods are not invoked.

To allow users to run on Java 11 without having jakarta-annotation-api
on the classpath, this commit removes use of `@PostConstruct` from main
code. A Checkstyle rule has also been added to prevent its usage in
main code from being reintroduced.

Closes gh-23723
2020-11-03 13:59:38 +00:00
Stephane Nicoll b67d746840 Fix metadata for deprecated logging.file properties
See gh-23609

Closes gh-23995
2020-11-02 18:09:27 +01:00
Phillip Webb fb59432cf5 Use Graal friendly logging factory implementations
Update `LoggingSystemFactory` class present checks to use a static
final field so that they work better with Graal.

Closes gh-23985
2020-11-01 12:54:43 -08:00
Phillip Webb 298880c260 Polish formatting 2020-11-01 12:50:31 -08:00
izeye 9c35cd41ad Polish
See gh-23986
2020-11-01 17:07:50 +01:00
Phillip Webb 929d8fcd3c Update copyright year of changed files 2020-10-29 09:08:13 -07:00
Phillip Webb a41ff4dfab Merge branch '2.3.x' 2020-10-29 09:07:57 -07:00
Phillip Webb b0c2687aa9 Update copyright year of changed files 2020-10-29 09:07:42 -07:00
Phillip Webb c0a0c4cbac Show the source jar of a ClasspathResource
Update `TextResourceOrigin` so that it shows the source jar file
of a `ClasspathResource`.

Closes gh-23019
2020-10-28 18:25:28 -07:00
Andy Wilkinson 74ec5f65d1 Make isPresent check more Graal-friendly
Closes gh-23925
2020-10-28 10:30:11 +00:00
Andy Wilkinson 12dcf147be Polish
See gh-21454
2020-10-28 07:09:47 +00:00
Phillip Webb 2e2b371679 Add auto-trimming support to configtree sources
Update `ConfigTreePropertySource` with an option to automatically trim
trailing new-line characters.

Closes gh-23826
2020-10-27 22:22:59 -07:00
Phillip Webb cf673cee55 Use stricter document properties separator logic
Update `OriginTrackedPropertiesLoader` with stricter logic around the
document separator. If the preceding or following lines are comments
then the separator will be ignored.

Closes gh-22963
2020-10-27 21:43:44 -07:00
Phillip Webb 0588e989af Don't adapt RandomPropertySource
Stop adapting `RandomPropertySource` to `ConfigurationPropertySource`
since it's not useful as a binding source.

Closes gh-21659
2020-10-27 20:41:13 -07:00
Andy Wilkinson f60f3cb38e Exclude property beans from method validation
Exclude `@ConfigurationProperties` beans from method validation so
that `@Validated` can be used on final classes without the method
validation post-processor throwing an exception.

This commit introduces a `FilteredMethodValidationPostProcessor` class
which will use `MethodValidationExcludeFilters` to exclude beans from
method validation processing. Using `@EnableConfigurationProperties`
will automatically register an appropriate filter.

Closes gh-21454
2020-10-27 15:43:00 -07:00
Phillip Webb a0862f9146 Support wildcard configtree imports
Update `ConfigTreeConfigDataResource` so that a wildcard suffix can
be used to import multiple folders. The pattern logic from
`StandardConfigDataLocationResolver` has been extracted into a new
`LocationResourceLoader` class so that it can be reused.

Closes gh-22958
2020-10-27 14:14:23 -07:00
Andy Wilkinson fafc0a91e3 Register @WebListeners in a way that allows them to register components
Previously, @WebListeners were discovered via custom component scanning
and then registered programmatically via the ServletContext. The servlet
spec requires any ServletContextListener registered in this manner to be
prohibited from programatically configuring servlets, filters, and
listeners. This left us not strictly complying with the servlet spec
as a ServletContextListener registered via a @WebListener annotation
should be able to programatically configure other components.

This commit updates WebListenerHandler to register each @WebListener
component directly with Jetty, Tomcat, or Undertow rather than via the
ServletContext API. This ensure that any @WebListener-annoated
ServletContextListener registered via servlet component scanning is
able to programatically register servlets, filters, and listeners.

There is a small chance that this will be a breaking change for some
users:

1. The ServletListenerRegistrationBeans that were previously defined
   for each @WebListener will now be
   WebListenerHandler.WebListenerRegistrars
2. Each @WebListener-annotated class will now be instantiated by
   Jetty, Tomcat, or Undertow. Jetty and Tomcat both require the class
   to be public and have a public default constructor. Previously,
   a package-private class or default constructor could be used as the
   instantiation was performed by Spring Framework. Undertow is not
   affected as it can instantiate a package-private type.

Fixes gh-18303
2020-10-26 13:26:52 -07:00
Phillip Webb 5e26954068 Provide default charset properties
Fixed gh-23827
2020-10-26 08:57:06 -07:00
Phillip Webb 771503f30d Attempt to fix flaky logging tests 2020-10-25 09:21:17 -07:00
Phillip Webb 70b7326b73 Refine exception handling in logging listener
Refine the exception handling block to cover initialization exceptions
without a log file.

Closes gh-23802
2020-10-25 09:21:17 -07:00
Stephane Nicoll cb31d9547c Merge branch '2.3.x' 2020-10-24 07:40:48 +02:00
Stephane Nicoll d1e503602b Polish 2020-10-24 07:39:50 +02:00
Stephane Nicoll 3adf167b47 Polish 2020-10-24 07:34:33 +02:00
Phillip Webb 062bd90d87 Add properties for logging charsets
Add `logging.charset.console` and `logging.charset.file` properties
that can be used to configure charsets for Logback/Log4J2.

Closes gh-23827
2020-10-23 18:54:24 -07:00
Phillip Webb 1725594a0e Rationalize Logback logging properties
Deprecate and provide alternatives for logging properties that are
specific to Logback.

The following Spring Boot properties have been changed:

  * logging.pattern.rolling-file-name ->
    logging.logback.rollingpolicy.file-name-pattern

  * logging.file.clean-history-on-start ->
    logging.logback.rollingpolicy.clean-history-on-start

  * logging.file.max-size ->
    logging.logback.rollingpolicy.max-file-size

  * logging.file.total-size-cap ->
    logging.logback.rollingpolicy.total-size-cap

  * logging.file.max-history ->
    logging.logback.rollingpolicy.max-history

As have the system environment properties that they map to:

  * ROLLING_FILE_NAME_PATTERN ->
    LOGBACK_ROLLINGPOLICY_FILE_NAME_PATTERN

  * LOG_FILE_CLEAN_HISTORY_ON_START ->
    LOGBACK_ROLLINGPOLICY_CLEAN_HISTORY_ON_START

  * LOG_FILE_MAX_SIZE ->
    LOGBACK_ROLLINGPOLICY_MAX_FILE_SIZE

  * LOG_FILE_TOTAL_SIZE_CAP ->
    LOGBACK_ROLLINGPOLICY_TOTAL_SIZE_CAP

  * LOG_FILE_MAX_HISTORY ->
    LOGBACK_ROLLINGPOLICY_MAX_HISTORY

This commit also cleans up and simplifies `DefaultLogbackConfiguration`.

Closes gh-23609
2020-10-22 12:55:02 -07:00
Scott Frederick 1907f3fe1e Merge branch '2.3.x'
Closes gh-23815
2020-10-22 14:20:35 -05:00
Andy Wilkinson 2d8528d5bd Adapt to deprecation of StringUtils.isEmpty(Object)
See gh-23774
2020-10-22 17:09:33 +01:00
Scott Frederick 43cfebaca0 Ignore properties files in hidden directories
This commit modifies the logic for finding properties files using
wildcard paths to ignore files if any part of the file path contains
a hidden directory. Hidden directories are common when Kubernetes
mounts config maps onto volumes in a pod, which was causing the same
properties files to be loaded multiple times.

Fixes gh-23160
2020-10-21 18:01:44 -05:00
Phillip Webb fb25104151 Remove unnecessary code
Remove code from `LogbackLoggingSystem.loadDefaults` that sets Logback
context properties from the Spring Environment. The code should not be
required since `LoggingSystemVariables` will have already set system
variables for the logging config to use.

Closes gh-23767
2020-10-20 18:13:23 -07:00
izeye 0e50e87e58 Polish
See gh-23762
2020-10-20 14:28:15 +02:00
Stephane Nicoll dd74810c80 Revert "Fix detection logic for embedded databases"
This reverts commit c4a5a34702.

See gh-23721
2020-10-19 12:25:00 +02:00
Andy Wilkinson 01077d8ced Merge branch '2.3.x'
Closes gh-23744
2020-10-19 10:25:50 +01:00
Andy Wilkinson e8187f9bb0 Merge branch '2.2.x' into 2.3.x
Closes gh-23743
2020-10-19 10:25:24 +01:00
Andy Wilkinson 2a40bd7853 Register shutdown hook so it can tidy up a partial refresh
Previously, the shutdown hook was only registered once refresh has
completed. If the JVM was shut down during refresh (or after refresh
and before the hook was registered) the hook wouldn't run and the
partially refreshed context would not be cleaned up.

This commit moves the registration of the shutdown hook to before
refresh processing begins. This ensures that the hook is available
to clean up the context if the JVM is shutdown while refresh is in
progress.

Fixes gh-23625
2020-10-19 09:16:07 +01:00
Johnny Lim 20f1c0ef0e Polish
See gh-23720
2020-10-17 08:14:32 +02:00
Stephane Nicoll 8d4498ef6c Merge branch '2.3.x' 2020-10-17 08:00:00 +02:00
Asha Somayajula c4a5a34702 Fix detection logic for embedded databases
Closes gh-23721
2020-10-17 07:51:24 +02:00
Stephane Nicoll bebdee3709 Polish
See gh-23693
2020-10-17 07:30:12 +02:00
Stephane Nicoll c0b267feb4 Polish "Fix detection logic for embedded databases"
See gh-23693
2020-10-16 16:32:29 +02:00
Asha Somayajula ab02084e7b Fix detection logic for embedded databases
See gh-23693
2020-10-16 15:54:54 +02:00
Phillip Webb bc7b6bdd88 Polish 2020-10-15 15:29:54 -07:00
Phillip Webb e360e4a75e Polish 'Add a FailureAnalyzer for ConfigDataNotFound'
See gh-23633
2020-10-15 12:11:29 -07:00
Michal Mlak be7d697121 Add a FailureAnalyzer for ConfigDataNotFound
Add a `FailureAnalyzer` to deal with `ConfigDataNotFoundException`.

See gh-23633
2020-10-15 12:05:21 -07:00
Phillip Webb 1cf9fc107e Improve ConfigData processing code
Refactor `ConfigData` processing code to make it less awkward to
follow.

Prior to this commit the `ConfigDataLocationResolver` would take a
String location and return a `ConfigDataLocation` instance. This was
a little confusing since sometimes we would refer to `location` as the
String value, and sometimes it would be the typed instance. We also
had nowhere sensible to put the `optional:` prefix logic and we needed
to pass a `boolean` parameter to a number of methods. The recently
introduced `Orgin` support also didn't have a good home.

To solve this, `ConfigDataLocation` has been renamed to
`ConfigDataResource`. This frees up `ConfigDataLocation` to be used
as a richer `location` type that holds the String value, the `Orgin`
and provides a home for the `optional:` logic.

This commit also cleans up a few other areas of the code, including
renaming `ResourceConfigData...` to `StandardConfigData...`. It also
introduces a new exception hierarchy for `ConfigDataNotFoundExceptions`.

Closes gh-23711
2020-10-15 11:33:57 -07:00
Phillip Webb f89b99bdbc Allow FailureAnalizers without ApplicationContext
Update `SpringApplication` so that `FailureAnalyzers` apply even if
the `ApplicationContext` was not created. If no `ApplicationContext`
is available, only `FailureAnalyzer` instances that do not implement
any `Aware` interfaces are considered.

Closes gh-23710
2020-10-15 11:18:26 -07:00
Stephane Nicoll 89b11b0078 Upgrade to Liquibase 3.10.3
This commit upgrades to Liquibase 3.10.3 and adds an explicit exclude
check as this version started to include a "banner.txt" at the root of
the classpath. Given it may override a banner configured by the user it
is ignored so that the default banner is displayed.

Users impacted by this change can rename their banner and configure the
"spring.banner.location" property to point to it.

Closes gh-23658
2020-10-15 10:20:28 +02:00
Scott Frederick de991616b0 Use config map name for configtree property sources
When Kubernetes mounts config maps onto volumes in a pod, it creates
hidden files on the pod filesystem with symbolic links to the
hidden files. The symlinks are named for the user-provided config
map that was mounted, while the hidden files have system-generated
names.

Prior to this commit, the property sources created by the
configtree property source were added to the environment using the
system-generated hidden file name instead of the user-provided
symlink name. This commit corrects that behavior so the property
sources are named as a user would expect.

Fixes gh-23232
2020-10-14 21:02:55 -05:00
Andy Wilkinson d0c6dbc2c7 Rename eagerInitFilters to align with Undertow's naming
Closes gh-23674
2020-10-14 18:03:06 +01:00
Andy Wilkinson a64f2699cc Configure Undertow not to presever path on forward by default
Closes gh-23619
2020-10-13 19:03:36 +01:00
Andy Wilkinson 98914b65bc Merge branch '2.3.x'
Closes gh-23672
2020-10-13 11:23:00 +01:00
Andy Wilkinson a9a32f39b5 Merge branch '2.2.x' into 2.3.x
Closes gh-23671
2020-10-13 11:20:18 +01:00
Andy Wilkinson 667ccdae84 Simplify temp directory creation and improve diagnostics
Closes gh-23622
2020-10-13 11:18:06 +01:00
Stephane Nicoll 01ddee2201 Polish 2020-10-10 08:23:28 +02:00
Scott Frederick 0f9e8315bc Replace use of deprecated Reactor MonoProcessor in tests
Fixes gh-23627
2020-10-09 15:14:32 -05:00
Phillip Webb 8b740c07e3 Merge branch '2.3.x' into master
Closes gh-23615
2020-10-07 11:41:25 -07:00
Phillip Webb 0709c7671f Merge branch '2.2.x' into 2.3.x
Closes gh-23614
2020-10-07 11:41:11 -07:00
Phillip Webb ce70e7d768 Merge branch '2.1.x' into 2.2.x
Closes gh-23613
2020-10-07 11:40:55 -07:00
Phillip Webb 1db2f5f960 Support Formatter conversion service beans
Update `ConversionServiceDeducer` to also include `Formatter` beans
when they are qualified with `@ConfigurationPropertiesBinding`.

Fixes gh-23576
2020-10-07 11:34:57 -07:00
Stephane Nicoll b69ede4556 Polish
See gh-23480
2020-10-07 14:40:56 +02:00
Stephane Nicoll ef2fee22cb Make sure that the type used for discovery implements DataSource
See gh-23480
2020-10-07 12:00:24 +02:00
Stephane Nicoll 1296b4dfe6 Revert "Support constructor binding on 3rd party classes"
This commit reverts the support of constructor binding on 3rd party
classes using @ImportConfigurationPropertiesBean

See gh-23172

Closes gh-23593
2020-10-07 10:53:01 +02:00
Stephane Nicoll 35d41e4ae2 Remove code deprecated in Spring Boot 2.2
Closes gh-22034
2020-10-06 08:17:10 +02:00
Stephane Nicoll b08da63da5 Polish 2020-10-05 17:37:11 +02:00
Stephane Nicoll d952a8f3a5 Avoid unnecessary reflection in builders
Closes gh-23560
2020-10-05 16:16:40 +02:00
Stephane Nicoll ebc9c575e3 Allow to customize RSocketServer's fragment size
Closes gh-23247
2020-10-05 13:58:57 +02:00
dreis2211 ecee9c0f9b Avoid unnecessary explicit initialization of Atomics
Constructor calls like new AtomicInteger(0) cause a volatile write that
can be saved in cases where the constructor parameter is the default
value.

See gh-23575
2020-10-02 16:43:34 +02:00
Stephane Nicoll 1e2ed8ab4c Update copyright of changed file
See gh-23571
2020-10-02 09:48:18 +02:00
mnhock fc89051242 Use platform-independent line separator
See gh-23571
2020-10-02 09:47:44 +02:00
Madhura Bhave 7c22e71753 Polish "Deprecate EmbeddedDatabaseConnection#HSQL"
See gh-23565
2020-10-01 16:56:48 -07:00
desainidhi99 d5a1421bbe Deprecate EmbeddedDatabaseConnection#HSQL in favor of HSQLDB
See gh-23565
2020-10-01 16:55:44 -07:00
Andy Wilkinson 65c7cd43db Merge branch '2.3.x'
Closes gh-23557
2020-10-01 12:38:44 +01:00
Andy Wilkinson 914dccade2 Merge branch '2.2.x' into 2.3.x
Closes gh-23555
2020-10-01 12:30:16 +01:00
Andy Wilkinson 323af718e2 Only change the method of requests that Jetty won't handle by default
Previously, JettyEmbeddedErrorHandler would change the method of every
request that is handles to GET. This was being done to work around
Jetty's error handling only dealing with GET, POST, and HEAD requests
by default. It had the unwanted side-effect of causing an error
response to a HEAD request having a body as, from the error handling's
perspective, it was a GET request.

This commit updates JettyEmbeddedErrorHandler to only set the method
on a request for which error handling is being performed if the method
isn't already one that will be handled, leaving the method of GET,
POST, and HEAD requests unchanged.

Unfortunately, short of implementing an HTTP client, this change cannot
be tested as the Apache HttpClient, OkHttp, and the JDK's
HttpURLConnection all silently drop the body of a response to a HEAD
request, preventing a test from asserting that a body hasn't been sent.

Closes gh-23551
2020-10-01 12:29:44 +01:00
Stephane Nicoll de32fab324 Adapt to API change in Spring Framework 5.3.0 snapshots
See gh-23534
2020-09-30 16:09:41 +02:00
Stephane Nicoll 366fec33d0 Adapt to API change in Spring Framework 5.3.0 snapshots
See gh-23534
2020-09-30 13:46:57 +02:00
Stephane Nicoll 75554ce236 Polish "Add support for Oracle UCP"
See gh-23403
2020-09-29 16:09:55 +02:00
Fabio Grassi a21ab392b6 Add support for Oracle UCP
See gh-23403
2020-09-29 14:45:48 +02:00
Andy Wilkinson a19a565410 Stop registering the default servlet by default
Previously, the default servlet was registered automatically when using
embedded Jetty, Tomcat, or Undertow. However, it is not used by the
majority of applications where Spring MVC's DispatcherServlet will be
the only servlet that's needed. As such configuring the default servlet
was wasting CPU and memory.

This commit changes the default for registering the default servlet to
false. It can be re-enabled by setting
server.servlet.register-default-servlet=true.

Closes gh-22915
2020-09-29 11:52:19 +01:00
Stephane Nicoll 57bc23284e Apply DataSource aliases only when necessary
This commit makes sure that aliases are only applied when they match
the DataSource being bound. This prevent an alias targetted to a
DataSource to accidently match an unexpected property of another
DataSource.

Closes gh-23480
2020-09-28 10:17:13 +02:00
Andy Wilkinson ab8d33aa72 Merge branch '2.3.x'
Closes gh-23482
2020-09-24 19:04:33 +01:00
Andy Wilkinson df5cd21ca5 Merge branch '2.2.x' into 2.3.x
Closes gh-23481
2020-09-24 19:04:17 +01:00
Andy Wilkinson 6dc8e6815d Align default tldScanPatterns with Tomcat's
Previously, we configured embedded Tomcat in such a way that no TLD
scan patterns were configured. This differed from a standalone
Tomcat installation where 4 patterns are configured that take
precedence over some of the skip patterns. The missing scan patterns
resulted in the skip patterns preventing the discovery of Log4j2's
TLDs.

This commit updates TomcatServletWebServerFactory to configure the
same four scan patterns as standalone Tomcat configures by default.

Fixes gh-23302
2020-09-24 17:51:38 +01:00
Andy Wilkinson 17d5e17069 Merge branch '2.3.x' 2020-09-22 16:26:58 +01:00
Andy Wilkinson 232c310df2 Merge branch '2.2.x' into 2.3.x 2020-09-22 16:26:39 +01:00
Andy Wilkinson 24102656f2 Fix Log4j2 XML configuration tests on Windows
See gh-22983
2020-09-22 16:03:58 +01:00
Phillip Webb bd2a252101 Polish 'Add origin support for empty YAML list and map'
See gh-21704
2020-09-21 16:45:16 -07:00
heinz f18d564add Add origin support for empty YAML list and map
Update `OriginTrackedYamlLoader` to better deal with empty maps
and collections.

See gh-21704
2020-09-21 16:44:22 -07:00
Phillip Webb c885a15aea Allow binding when 'is' method also exists
Improve the `JavaBeanBinder` so that an bean that has both a `get` and
`is` method can still be bound.

Closes gh-23007
2020-09-21 16:35:54 -07:00
Phillip Webb fde2e440bb Add missing registration convenience methods
Update `BootstrapContext` with convenience methods that help if the
type has not been registered.

Closes gh-23438
2020-09-21 16:08:36 -07:00
Phillip Webb 0df37302af Make ConfigData Resolvers/Loaders public
Change the visibility of our own ConfigDataLocationResolver and
ConfigDataLoader classes so that they can be created outside of
`spring.factories`.

Closes gh-23434
2020-09-21 15:36:04 -07:00
Andy Wilkinson 3587ecb043 Merge branch '2.3.x' 2020-09-21 19:28:53 +01:00
Andy Wilkinson 0963218be1 Merge branch '2.2.x' into 2.3.x 2020-09-21 19:28:39 +01:00
Andy Wilkinson 0edf7cb9b9 Polish Log4j2 XML configuration tests
See gh-22983
2020-09-21 19:26:40 +01:00
Andy Wilkinson 5a3232d681 Merge branch '2.3.x'
Closes gh-23430
2020-09-21 15:21:17 +01:00
Andy Wilkinson 13e08a4344 Merge branch '2.2.x' into 2.3.x
Closes gh-23428
2020-09-21 15:15:08 +01:00
Andy Wilkinson f6492cd0c0 Consume level and dateformat patterns as system props in Log4j config
Previously LOG_LEVEL_PATTERN and LOG_DATEFORMAT_PATTERN were not
consumed as system properties in log4j2.xml and log4j2-file.xml. As a
result, the logging.pattern.level and logging.pattern.dateformat
configuration properties, which are translated into the
LOG_LEVEL_PATTERN and LOG_DATEFORMAT_PATTERN system properties
respectively had no effect.

This commit updates the log4j2.xml and log4j2-file.xml config files to
consume LOG_LEVEL_PATTERN and LOG_DATEFORMAT_PATTERN as system
properties. When the system property is not set, the configuation falls
back to the default values specified in the config files. Tests for
both log4j2.xml and log4j2-file.xml to verify the behaviour have also
bean added.

Fixes gh-22983
2020-09-21 15:08:41 +01:00
Andy Wilkinson fee1e3aa2b Polish javadoc of LoggingSystemFactory
See gh-23387
2020-09-20 17:03:17 +01:00
Phillip Webb 8f5959ba1d Fix LoggingSystem package tangle
Introduce a new `LoggingSystemFactory` interface so that the
`LoggingSystem` class can find implementations without needing to
be directly tied to them.

Closes gh-23387
2020-09-19 14:21:04 -07:00
Phillip Webb 35673b7472 Add Binder to BootstrapContext
Update `ConfigDataEnvironment` so that it adds the initial `Binder`
to the `BootstrapContext` for `Bootstrappers` to use.

Closes gh-23401
2020-09-17 12:37:19 -07:00
Phillip Webb 8b8d5ccb10 Allow trailing whitespace document split marker
Refine `OriginTrackedPropertiesLoader` document split detection to be
more lenient if there is trailing whitespace.

Closes gh-23399
2020-09-17 11:23:59 -07:00
Andy Wilkinson ea5c6c2923 Polish BootstrapRegistry's javadoc
See gh-23326
2020-09-17 09:55:05 +01:00
Phillip Webb 99dc7914b2 Attempt to fix ConcurrentModificationException
Attempt to fix `ConcurrentModificationException` which occurs on
Java 11+.

See gh-23326
2020-09-17 01:41:39 -07:00
Phillip Webb c284edde67 Update copyright year of changed files 2020-09-17 00:31:01 -07:00
Phillip Webb 1ae1436211 Refactor BootstrapRegistry support
Refactor `BootstrapRegistry` support following initial prototype work
with the Spring Cloud team.

This update splits the `BootstrapRegistry` API into `BootstrapRegistry`,
`BootstrapContext` and  `ConfigurableBootstrapContext` interfaces and
moves it to the same package as `SpringApplication`.

A new `Bootstrapper` interface has been introduced that can be added
to the `SpringApplication` to customize the `BootstrapRegistry` before
it's used.

Closes gh-23326
2020-09-17 00:31:00 -07:00
Phillip Webb 10ad53afbd Fix FailureAnalyzer package tangle
Move `IncompatibleConfigurationFailureAnalyzer` to fix a package tangle.

Closes gh-23385
2020-09-17 00:31:00 -07:00
Phillip Webb 6509310fdb Fix DefaultPropertiesPropertySource package tangle
Relocate `DefaultPropertiesPropertySource` to fix a package tangle.

Closes gh-23383
2020-09-17 00:31:00 -07:00
Stephane Nicoll fa03f75d21 Upgrade to Undertow 2.2.0.Final
Closes gh-23367
2020-09-16 14:40:12 +02:00
Phillip Webb 43010ebf47 Merge branch '2.3.x'
Closes gh-23329
2020-09-16 00:28:57 -07:00
Phillip Webb f590225c82 Merge branch '2.2.x' into 2.3.x
Closes gh-23328
2020-09-16 00:28:29 -07:00
Phillip Webb bd87ba33d0 Use ephemeral ports for RSocket tests
Closes gh-23325
2020-09-16 00:15:19 -07:00
Phillip Webb 5f49d4a8d7 Rename @ConfigurationPropertiesImport
Rename `@ConfigurationPropertiesImport` to
`@ImportAsConfigurationPropertiesBean` and also refine the registrar
so that it can be used with type directly annotated with
`@ConfigurationProperties`.

Closes gh-23172
2020-09-15 11:36:00 -07:00
Stephane Nicoll 201bfd2b0c Upgrade to Netty 4.1.52.Final
Closes gh-23313
2020-09-15 14:55:38 +02:00
Phillip Webb c857a743a0 Rename @ImportConfigurationPropertiesBean
Rename `@ImportConfigurationPropertiesBean` to
`@ConfigurationPropertiesImport`.

Closes gh-23172
2020-09-14 19:35:10 -07:00
Andy Wilkinson 7562c4eb6f Adapt to WebClient's new exception wrapping
See spring-projects/spring-framework#23842
See gh-23170
2020-09-14 15:08:56 +01:00
Stephane Nicoll f4a84d3b63 Upgrade to Netty 4.1.52.Final
Closes gh-23287
2020-09-14 13:37:57 +02:00
Stephane Nicoll 492e1a4c0f Upgrade to Netty 4.1.52.Final
Closes gh-23269
2020-09-14 11:28:55 +02:00
Phillip Webb a95dbb5d8f Merge branch '2.3.x'
Closes gh-23261
2020-09-13 11:02:54 -07:00
Phillip Webb 5294c34807 Merge branch '2.2.x' into 2.3.x
Closes gh-23260
2020-09-13 11:02:19 -07:00
Phillip Webb 326a56da01 Support validation of bound map key entries
Update `ValidationBindHandler` so that pushed fields that reference
map keys can be used. This fixes a regression that was introduced in
commit 4483f417 when we switched to a `AbstractBindingResult` that no
longer required public getters/setters.

Closes gh-20350
2020-09-13 10:54:30 -07:00
Brian Clozel 0715750eb3 Polish "Add SSL support to RSocketServer"
See gh-19399
2020-09-10 15:14:55 +02:00
cbono b4810b8b91 Add SSL support to RSocketServer
See gh-19399
2020-09-10 15:14:55 +02:00
Phillip Webb f260c77fe3 Add @ImportConfigurationPropertiesBean support
Add repeatable `@ImportConfigurationPropertiesBean` annotation that can
be used to import types and treat them as `@ConfigurationProperties`
beans. This annotation is specifically designed to support third-party
classes that can't contain any Spring annotations.

Closes gh-23172
2020-09-09 22:05:49 -07:00
Phillip Webb df944c6354 Polish 2020-09-08 11:19:33 -07:00
Brian Clozel 6be4409fde Add mainApplicationClass tag to startup step
This commit adds a new tag to the `"spring.boot.application.starting"`
startup step.

Closes gh-23162
2020-09-07 18:04:42 +02:00
Brian Clozel fdf21da7ba Add buffering ApplicationStartup variant
As of spring-projects/spring-framework#24878, Spring Framework provides
an `ApplicationStartup` infrastructure that applications can use to
collect and track events during the application startup phase.

This commit adds a new `BufferingApplicationStartup` implementation that
buffer `StartupStep`s and tracks their execution time. Once buffered,
these steps can be pushed to an external metrics system or drained
through a web endpoint, to a file...

Closes gh-22603
2020-09-07 18:04:31 +02:00
Andy Wilkinson b2cc442539 Merge branch '2.3.x'
See gh-23204
2020-09-07 14:17:11 +01:00
Andy Wilkinson 86fc4dea2a Merge branch '2.2.x' into 2.3.x
See gh-23203
2020-09-07 14:16:37 +01:00
Andy Wilkinson 5f00d91176 Restore identifying org.hsqldb.jdbcDriver as embedded
See gh-23036
2020-09-07 14:03:10 +01:00
Andy Wilkinson 9bf6e1ceda Merge branch '2.3.x'
Closes gh-23205
2020-09-07 13:34:47 +01:00
Andy Wilkinson 116b2472a7 Merge branch '2.2.x' into 2.3.x
Closes gh-23200
2020-09-07 13:34:14 +01:00
Andy Wilkinson 115ea87b14 Restore ordering of ErrorPageFilter lost in 49f8943
See gh-19471
2020-09-07 13:33:43 +01:00
Andy Wilkinson 3dfe11e9e3 Merge branch '2.3.x'
Closes gh-23204
2020-09-07 13:30:26 +01:00
Andy Wilkinson d39b107917 Merge branch '2.2.x' into 2.3.x
Closes gh-23203
2020-09-07 13:30:02 +01:00
Andy Wilkinson c948c70c5a Align EmbeddedDatabaseConnection with DatabaseDriver
Fixes gh-23036
2020-09-07 10:13:55 +01:00
Stephane Nicoll 73c039e4b8 Fix use of deprecated methods 2020-09-07 09:42:19 +02:00
Stephane Nicoll d2eeb9524f Merge branch '2.2.x' into 2.3.x
See gh-23183
2020-09-07 09:17:51 +02:00
Stephane Nicoll 4b5a3f4ff9 Start building against Spring Framework 5.2.9 snapshots
See gh-23182
2020-09-07 08:47:57 +02:00
Stephane Nicoll 1b68efa478 Polish "Upgrade to Assertj 3.17.2"
See gh-23179
2020-09-07 07:59:50 +02:00
Eddú Meléndez db8d117d38 Upgrade to Assertj 3.17.2
See gh-23179
2020-09-07 07:54:25 +02:00
Brian Clozel f50927f7a1 Start building against Spring Framework 5.3.0.RC1 SNAPSHOTs
See gh-23170
2020-09-02 17:47:06 +02:00
Andy Wilkinson 2c981d99a2 Avoid unnecessary reflection in TaskExecutorBuilder
Closes gh-23107
2020-09-01 12:46:22 +01:00
Phillip Webb 446dfe4ad7 Merge branch '2.3.x'
Closes gh-23153
2020-08-31 15:31:49 -07:00
Phillip Webb 0d80f46cef Remove node and recursive limits for YAML
Update `OriginTrackedYamlLoader` to remove node limits and recursive
parsing restrictions. SnakeYAML 1.26 introduced these options in order
to protect against the "billion laugh attacks" but since we consider
`application.yml` files to be trusted, we don't need these restrictions.

Fixes gh-23096
2020-08-31 15:27:37 -07:00
Phillip Webb 0ddd1b6ce8 Refine global optional config data opt-out
Rename the opt-out property and use an enum in case we want to provide
additional options in the future.

Closes gh-23097
2020-08-28 16:30:39 -07:00
Phillip Webb bebb4363d6 Merge branch '2.3.x' 2020-08-28 15:31:09 -07:00
Phillip Webb 98f432681f Merge branch '2.2.x' into 2.3.x 2020-08-28 15:30:57 -07:00
Phillip Webb 611447c4d5 Fix checkstyle issue caused by polish commit
See gh-22946
2020-08-28 15:30:27 -07:00
Phillip Webb 21897a7097 Merge branch '2.3.x'
Closes gh-23136
2020-08-28 15:23:26 -07:00
Phillip Webb 84f281fbfd Merge branch '2.2.x' into 2.3.x
Closes gh-23135
2020-08-28 15:23:10 -07:00
Phillip Webb 35994b061c Polish 'Remove ResourceUtils.getURL logging config check'
Extend `initializeSystem` to search the exception stack for a
FileNotFoundException before reporting the error. This allows
us to provide a similar stack trace to the one that used to be
thrown when we had the `ResourceUtils.getURL` check.

See gh-22946
2020-08-28 15:16:12 -07:00
Ralph Goers 684b65e80c Remove ResourceUtils.getURL logging config check
Remove `ResourceUtils.getURL` checking from `LoggingApplicationListener`
so that logging systems can implement custom location support.

Prior to this commit, we checked in the listener if the specified config
location could be opened as a URL. This unfortunately prevents Log4J
extensions such as `log4j-spring-cloud-config-client` from implementing
configurable SSL and credentials support.

See gh-22946
2020-08-28 15:07:06 -07:00
Phillip Webb 3c1e141aef Add parent origin support to config data
Allow `ConfigDataLocationResolvers` to access `Origin` information for
locations so that they can be used as a parent origin of loaded items.

The `ResourceConfigData...` classes have been reworked so that loaded
`PropertySources` include the parent origin.

See gh-23018
2020-08-27 22:15:51 -07:00
Phillip Webb 960651c15a Add parent origin support
Update the `Origin` interface to include a default `getParent()` method
which can be used to get the parent origin. The `TextResourceOrigin`
has been updated to implement the method against the source `Resource`.
A new `OriginTrackedResource` implementation allows any `Resource` to
be decorated and carry an optional `Origin`.

Ultimately this will allow us to include parent `Origin` information
on properties loaded via a `PropertySourceLoader` without needing any
changes to that interface.

See gh-23018
2020-08-27 22:05:04 -07:00
Phillip Webb bc5958c398 Polish test method names
Polish method names to remove "should".
2020-08-27 21:28:16 -07:00
Phillip Webb c613d119f7 Support binding with multiple constructors
Update `DefaultBindConstructorProvider` so that binding to objects with
multiple constructors is allowed, as long as there is only one
non-public candidate.

Closes gh-23117
2020-08-27 21:28:16 -07:00
Phillip Webb a2530ad5f1 Fix global optional config data opt-out test
See gh-23097
2020-08-26 21:06:21 -07:00
Phillip Webb aa0f204732 Add global optional config data opt-out
Support a `spring.config.all-locations-optional` property which can be
set to `true` if all config data locations should be considered
optional.

Closes gh-23097
2020-08-26 20:11:40 -07:00
Phillip Webb c1be5cb5e0 Add limited support for spring.profiles.include
Restore support for the `spring.profiles.include` property but only
for non-profile specific documents.

Closes gh-22944
2020-08-26 15:43:28 -07:00
Johnny Lim e48af31ced Polish
See gh-23081
2020-08-26 10:47:45 +02:00
Andy Wilkinson 4320b3a919 Merge branch '2.3.x'
Closes gh-23089
2020-08-26 09:04:09 +01:00
Andy Wilkinson 4143c31f9c Merge branch '2.2.x' into 2.3.x
Closes gh-23087
2020-08-26 09:03:46 +01:00