Commit Graph

1973 Commits

Author SHA1 Message Date
Brian Clozel 4ef08425e6 Require RSocket 1.0+
This commit removes usage of methods and classes that were previously
deprecated in RSocket and Spring Framework and have been removed.

Closes gh-22764
2020-08-06 16:10:43 +02:00
Brian Clozel 9f558181d5 Instrument SpringBootApplication for ApplicationStartup
This commit allows the configuration of a custom `ApplicationStartup`
implementation on the `SpringApplication` and
`SpringApplicationBuilder` for collecting `StartupStep` metrics.

This also instruments Spring Boot run listeners and server-specific
application context implementations for collecting Spring Boot
application events during startup.

Closes gh-22600
2020-08-06 12:08:02 +02:00
Madhura Bhave 5f386e456b Fix test 2020-08-05 14:59:27 -07:00
Madhura Bhave b9abcf1615 Fail hard if spring.profiles.include is used with new config processing
Closes gh-22693
2020-08-05 14:41:32 -07:00
Brian Clozel fb1234a22c Upgrade to Reactor 2020.0.0 SNAPSHOTs
See gh-22667
2020-08-04 13:26:47 +02:00
dreis2211 e49e2dfff1 Use Supplier variants of Assert methods
See gh-22699
2020-08-03 15:06:13 +02:00
Andy Wilkinson 1168d8fa74 Reduce reflection in LoggingSystem to make it more Graal-friendly
Closes gh-22594
2020-08-03 11:38:10 +01:00
Andy Wilkinson 11a296b068 Polish "Fix NPE in BeanDefinitionLoader when XML support is disabled"
See gh-22696
2020-08-03 09:54:43 +01:00
dreis2211 2bdeba8aaa Fix NPE in BeanDefinitionLoader when XML support is disabled
See gh-22696
2020-08-03 09:53:40 +01:00
Andy Wilkinson 6c67c5d763 Try to fix Windows-specific CI failures 2020-07-31 16:02:14 +01:00
Andy Wilkinson aaa911db16 Merge branch '2.3.x'
Closes gh-22673
2020-07-30 13:41:33 +01:00
Andy Wilkinson 6ee0f8df1b Merge branch '2.2.x' into 2.3.x
Closes gh-22672
2020-07-30 13:41:17 +01:00
Andy Wilkinson 49f8943a5f Register ErrorPageFilter for async dispatch
Fixes gh-19471
2020-07-30 13:38:02 +01:00
Andy Wilkinson f96a688c1b Polish "Allow DurationFormat and PeriodFormat to be used on parameters"
See gh-22646
2020-07-30 09:34:26 +01:00
dreis2211 914452b2cc Allow DurationFormat and PeriodFormat to be used on parameters
See gh-22646
2020-07-30 09:26:41 +01:00
Gerrit Meier 15cd343737 Upgrade to Spring Data Neo4j 6
See gh-22299
2020-07-29 18:58:08 +02:00
Brian Clozel 6f2098ad71 Upgrade to Spring Framework 5.3.0-SNAPSHOT
This commit also switches to RSocket SNAPSHOTs and updates the
repository configuration to rely on "libs-snapshot", since the RSocket
SNAPSHOTs are mirrored there.

See gh-22640
2020-07-29 14:41:17 +02:00
Andy Wilkinson 7aa093e0ca Merge branch '2.3.x'
Closes gh-22636
2020-07-29 11:05:51 +01:00
Andy Wilkinson 5dd7780a38 Try to stabilise descendantOfPropertyAccess performance test
Closes gh-22633
2020-07-29 10:56:30 +01:00
Madhura Bhave 8d70010fce Add expanded profile groups to environment
Fixes gh-22605
2020-07-28 11:39:17 -07:00
Andy Wilkinson 273718c7df Merge branch '2.3.x'
Closes gh-22612
2020-07-28 09:15:26 +01:00
Andy Wilkinson c2df326f6f Merge branch '2.2.x' into 2.3.x
Closes gh-22611
2020-07-28 09:15:14 +01:00
Andy Wilkinson ea5284ca91 Polish "Use milliseconds when configuring awaitTerminationPeriod"
See gh-22604
2020-07-28 09:03:57 +01:00
Tadaya Tsuyukubo 685a6116d1 Use milliseconds when configuring awaitTerminationPeriod
Prior to this change, TaskExecutorBuilder used seconds as its precision
to map the awaitTerminationPeriod value. This caused a loss of
millisecond information in the period.

This commit fixes the loss by converting the period to millisecond and
using setAwaitTerminationMillis to configure the executor.

See gh-22604
2020-07-28 09:01:55 +01:00
Phillip Webb 84bcd0eb1e Improve deprecated exception message
Update the exception message so that it includes the class name of the
implementation.

See gh-22497
2020-07-27 09:06:33 -07:00
Andy Wilkinson 1efac09913 Merge branch '2.3.x'
Closes gh-22586
2020-07-27 13:37:34 +01:00
Andy Wilkinson 8ff2b9f2e8 Merge branch '2.2.x' into 2.3.x
Closes gh-22585
2020-07-27 13:37:23 +01:00
Andy Wilkinson 1b48daf1d5 Do not ignore unknown fields when invalid fields are being ignored
Previously, ignoring invalid fields would cause the failure for an
unknown field to be ignored, irrespective of the ignoreUnknownFields
attribute on `@ConfigurationProperties`.

This commit updates the NoUnboundElementsBindHandler to ensure that
any UnboundConfigurationPropertiesException is thrown rather than
being ignored when the handler has been wrapped by an
IgnoreErrorsBindHandler.

Fixes gh-22308
2020-07-27 13:28:44 +01:00
izeye 6eba7c5f10 Polish
See gh-22549
2020-07-25 07:26:49 +02:00
dreis2211 923474fa48 Polish
See gh-22535
2020-07-24 12:58:12 +02:00
Dave Syer 48f49f2120 Restore missing EnvironmentPostProcessors
See gh-22544
2020-07-24 08:46:04 +01:00
Phillip Webb 36a6ca6e6e Add EnvironmentPostProcessorsFactory
Update `EnvironmentPostProcessorApplicationListener` so that it can
either use values from `spring.factories` or use a factory interface.

Closes gh-22529
2020-07-23 11:43:02 -07:00
dreis2211 b01fb63de6 Polish
See gh-22524
2020-07-23 18:16:34 +02:00
Madhura Bhave 3f76eb2097 Add volume mount property source support
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>
2020-07-22 21:03:37 -07:00
Madhura Bhave eee260fc03 Add support for profile groups
Add support for profile groups so that users can combine a number of
fine-grained profiles into a single logical group.

Closes gh-22522
2020-07-22 21:03:37 -07:00
Phillip Webb 3352024b1c Provide ConfigFileApplicationListener replacement
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>
2020-07-22 21:02:32 -07:00
Phillip Webb 44f18362d3 Add Binder backed CloudPlatform.isEnforced method
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
2020-07-22 21:00:14 -07:00
Phillip Webb cd36444641 Extract DefaultPropertiesPropertySource class
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
2020-07-22 20:58:32 -07:00
Phillip Webb 039fbdfa7c Add DeferredLogFactory support
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
2020-07-22 20:58:31 -07:00
Madhura Bhave 9e9eb90d09 Add multi-document properties file support
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>
2020-07-22 20:58:24 -07:00
Phillip Webb 945e5b9222 Add ConfigurationPropertySource.from method
Add a factory method to `ConfigurationPropertySource` that allows a
single Spring `PropertySource` instance to be adapted.

Closes gh-22494
2020-07-22 20:57:43 -07:00
Phillip Webb 078e146983 Filter empty YAML documents
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
2020-07-22 20:57:43 -07:00
Phillip Webb fdc6e80163 Add trailing escape character test
Update `OriginTrackedPropertiesLoaderTests` to also test that an escape
character can be the last character on a line.
2020-07-22 20:57:36 -07:00
Phillip Webb 2eeffe7931 Add @Name support for value object binding
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
2020-07-22 18:50:23 -07:00
Phillip Webb 2d3ac4bb2e Polish 2020-07-22 18:50:22 -07:00
Phillip Webb 3d7d9d064c Update copyright year of changed files 2020-07-22 18:50:07 -07:00
Phillip Webb 14c1b0938a Polish 2020-07-22 18:25:27 -07:00
Phillip Webb da69286838 Merge branch '2.3.x' 2020-07-22 17:39:27 -07:00
Phillip Webb 187d3af7fc Update copyright year of changed files 2020-07-22 17:25:17 -07:00
Phillip Webb b5e70157dc Update copyright year of changed files 2020-07-22 17:01:36 -07:00
Andy Wilkinson 01558100d1 Do not attempt to use AprLifecycleListener in a native image
Closes gh-22485
2020-07-22 06:30:39 +01:00
Andy Wilkinson 0fd567664a Make DefaultErrorAttributes easier to subclass for message customization
Closes gh-22378
2020-07-21 10:30:33 +01:00
Andy Wilkinson 0ce0c3a54a Polish "Add failure analyzer for missing Liquibase changelog"
See gh-22320
2020-07-17 14:44:25 +01:00
Sebastiaan Fernandez 554a962a13 Add failure analyzer for missing Liquibase changelog
See gh-22320
2020-07-17 14:44:25 +01:00
Andy Wilkinson 0c8e52e877 Avoid using reflection to create SpringApplication's context
Closes gh-22322
2020-07-16 15:03:08 +01:00
Andy Wilkinson 4d1a19f316 Broaden cast as registry may be a GenericApplicationContext
Closes gh-22318
2020-07-14 16:43:27 +01:00
Andy Wilkinson 2af550ef73 Avoid using reflection with manual bean definitions
Closes gh-22318
2020-07-14 14:11:51 +01:00
Andy Wilkinson e3b839a48a Merge branch '2.3.x'
Closes gh-22326
2020-07-14 11:40:52 +01:00
Andy Wilkinson 196d20537a Merge branch '2.2.x' into 2.3.x
Closes gh-22325
2020-07-14 11:38:34 +01:00
Andy Wilkinson 9558779dd4 Replace ConfigurationPropertiesBeanDefinitionValidator with a FailureAnalyzer
Previously, regular bean definitions for configuration properties classes
that attempt to use constructor binding were detected in a bean factory
post-processor, ConfigurationPropertiesBeanDefinitionValidator. This
validation examined every standard bean definition and failed if it
encountered one for a class that should have used constructor binding.
There were two downsides to this approach:

1. Reflection used to identify if the bean should be using constructor
   binding triggered class loading that could prevent subsequent
   instrumentation by a load-time weaver.
2. The cost of the validation was incurred when there was no
   misconfiguration to report.

This commit replaces ConfigurationPropertiesBeanDefinitionValidator
with a failure analyzer. This failure analyzer only runs once a failure
has occurred and the application context is not going to complete
refresh. This avoids causing problems with subsequent instrumentation
and also avoids the cost of validation and error reporting unless there
is an error.

Fixes gh-20798
2020-07-14 11:37:54 +01:00
Andy Wilkinson 2643c60c5a Merge branch '2.3.x'
Closes gh-22316
2020-07-13 14:16:45 +01:00
Andy Wilkinson f52cdf10b3 Update WebServerInitEvent docs to reflect ordering w.r.t. refresh
Closes gh-22277
2020-07-13 12:51:07 +01:00
Brian Clozel 0f264b68e8 Add option to configure PathPatternParser
As of Spring Framework 5.3, it is now possible to use `PathPatternParser`
to parse and match request mapping path patterns, as an alternative to
the current default `AntPathMatcher`.

This new implementation has been used for a while in Spring WebFlux and
it’s been designed for consistency and performance.

This commit introduces a new configuration property for opting-in this
new variant:

`spring.mvc.pathmatch.matching-strategy=path_pattern_parser`

The default option is still `ant_path_matcher` for now, but we might
change the default in future versions since Spring Framework considers
it the best choice for modern applications.

There are several behavior differences with this new variant:

* double wildcards `"**"` are rejected when used in the middle patterns,
this is only allowed as the last matching segment in a pattern.

* it is incompatible with some path matching options, like
suffix-pattern, registered-suffix-pattern or configuring a Servlet
prefix on the `DispatcherServlet` (`spring.mvc.servlet.path=/test`)

This commit introduces two `FailureAnalyzer` implementations to guide
developers when facing those issues.

Closes gh-21694
2020-07-09 21:34:00 +02:00
Andy Wilkinson f0e4149da4 Merge branch '2.3.x'
Closes gh-22287
2020-07-09 12:45:49 +01:00
Andy Wilkinson df67816e55 Try to make ConfigurationPropertySourcesTests perf tests more robust
Previously, the tests used absolute values to verify that the work
had completed sufficiently quickly. This led to flaky tests in
environments where the performance can be variable such as CI.

This commit tries to make the tests more robust by comparing the
performance to a baseline and requiring it to be twice as fast.

Closes gh-22137
2020-07-09 12:36:06 +01:00
Stephane Nicoll 429a504bbe Polish "Allow data unit to be specified on the constructor parameter"
See gh-21746
2020-07-09 11:51:32 +02:00
Vlad Kisel ba70b79651 Allow data unit to be specified on the constructor parameter
See gh-21746
2020-07-09 11:51:32 +02:00
Johnny Lim 4ab4c61761 Polish ErrorPage.equals()
See gh-22240
2020-07-07 14:01:16 +02:00
Andy Wilkinson 29b69bfbdf Merge branch '2.3.x'
Closes gh-22250
2020-07-07 11:43:17 +01:00
Andy Wilkinson da319f5f59 Merge branch '2.2.x' into 2.3.x
Closes gh-22249
2020-07-07 11:43:03 +01:00
Andy Wilkinson 14f24dbecc Merge branch '2.1.x' into 2.2.x
Closes gh-22248
2020-07-07 11:42:43 +01:00
Andy Wilkinson 26f591264c Fix handling of NestedServletException with no root cause
Fixes gh-22169
2020-07-07 11:34:25 +01:00
dreis2211 507eb9498b Use Class.getDeclaredConstructor().newInstance()
See gh-21913
2020-07-07 11:12:35 +01:00
Andy Wilkinson 3c7f54b97f Polish "Remove redundant close() call from JarResourceManagerTests"
See gh-22213
2020-07-07 10:17:22 +01:00
XenoAmess 623b3ab96e Remove redundant close() call from JarResourceManagerTests
See gh-22213
2020-07-07 10:16:20 +01:00
Andy Wilkinson cd8081f952 Polish "Use new ArrayList(Collection) rather than new and addAll"
See gh-22211
2020-07-07 10:09:48 +01:00
XenoAmess fb70c529d4 Use new ArrayList(Collection) rather than new and addAll
See gh-22211
2020-07-07 10:07:29 +01:00
XenoAmess 66dc24062f Fix typos in test code
See gh-22218
2020-07-07 10:01:48 +01:00
Andy Wilkinson 523dd937cd Merge branch '2.3.x'
Closes gh-22238
2020-07-06 19:58:45 +01:00
Andy Wilkinson 28128a9577 Add support for ChronoUnit.WEEKS when using PeriodUnit
Fixes gh-22225
2020-07-06 19:57:26 +01:00
Andy Wilkinson 0141f554b8 Merge branch '2.3.x' 2020-07-06 16:00:10 +01:00
Andy Wilkinson d1f074858e Correct class name of StringToPeriodConverterTests 2020-07-06 15:59:32 +01:00
dreis2211 20debcd471 Remove redundant deprecation suppression
See gh-22178
2020-07-01 09:03:28 +01:00
Andy Wilkinson 27c458ca26 Merge branch '2.3.x'
Closes gh-22160
2020-06-30 10:53:49 +01:00
Andy Wilkinson f86831da9c Use TCCL at time of access for resource loading
Fixes gh-22119
2020-06-30 10:51:13 +01:00
Madhura Bhave 255f8197ab Merge branch '2.3.x'
Closes gh-22156
2020-06-29 17:09:05 -07:00
Madhura Bhave f19f2b8714 Merge branch '2.2.x' into 2.3.x
Closes gh-22155
2020-06-29 17:08:37 -07:00
May c1b9d3c226 Simplify logic in ErrorPage's equals method
See gh-22082
2020-06-29 17:06:49 -07:00
Madhura Bhave 75abb9cc18 Merge branch '2.3.x'
Closes gh-22153
2020-06-29 16:36:25 -07:00
Johnny Lim 43aee1bddd Polish
See gh-22090
2020-06-29 16:35:23 -07:00
Madhura Bhave c3ddfcdbf5 Trim trailing whitespace from value of logging.config
Closes gh-22078
2020-06-25 15:18:40 -07:00
Andy Wilkinson d12b6b3a86 Disable LogbackLoggingSystem's XML support when spring.xml.ignore=true
Closes gh-22106
2020-06-25 13:01:45 +01:00
Andy Wilkinson 308e337009 Polish "Disable XML reader when spring.xml.ignore is true"
See gh-22093
2020-06-25 11:52:43 +01:00
Sébastien Deleuze 8d5cf79675 Disable XML reader when spring.xml.ignore is true
This commit allows to set the XmlBeanDefinitionReader field from
BeanDefinitionLoader to null in a way that allows the GraalVM native
compiler to remove it from the native image when the spring.xml.ignore
flag introduced by spring-projects/spring-framework#25151
is set to true.

The purpose of this change is to allow smaller footprint on native
images without requiring to use GraalVM native substitutions
which are unmaintainable by nature and also to increase the consistency
between JVM and native images.

In order to effective, this optimization requires BeanDefinitionLoader
class to be initialized at build time.

See gh-22093
2020-06-25 11:51:27 +01:00
Andy Wilkinson ea30c096dd Polish 16263e3
See gh-22105
2020-06-25 11:49:35 +01:00
Andy Wilkinson 16263e342c Move bean definition counting only used in tests into test code
Closes gh-22105
2020-06-25 11:33:09 +01:00
Andy Wilkinson 0d6ea79007 Start building against Spring Framework 5.3.0 snapshots
See gh-21929
2020-06-22 18:02:21 +01:00
Andy Wilkinson a0946c8923 Start building against Reactor 2020.0.0 snapshots
See gh-21927
2020-06-22 17:34:56 +01:00
Stephane Nicoll 51e9a5dae0 Merge branch '2.3.x'
Closes gh-22029
2020-06-19 14:15:32 +02:00
Johnny Lim b218a89862 Remove Javadoc throw for ConfigurationPropertyName.ofIfValid()
See gh-22018
2020-06-19 14:14:57 +02:00
Andy Wilkinson 01c270d54b Merge branch '2.3.x'
Closes gh-22011
2020-06-18 11:03:49 +01:00
Andy Wilkinson ce907b129c Merge branch '2.2.x' into 2.3.x
Closes gh-22010
2020-06-18 11:03:32 +01:00
Andy Wilkinson 1b62abab9a Configure context on SizeAndTimeBasedRollingPolicy
Previously, when file-based logging was enabled, Logback would output
the following during logging system initialization:

LOGBACK: No context given for c.q.l.core.rolling.SizeAndTimeBasedRollingPolicy

This commit updates the default logback configuration to set the
context on the SizeAndTimeBasedRollingPolicy that it creates.

Fixes gh-21056
2020-06-18 11:01:26 +01:00
Stephane Nicoll f0f8424191 Merge branch '2.3.x'
Closes gh-22008
2020-06-18 11:31:00 +02:00
dreis2211 855d596c2a Use lazy lambda instead of explicit argument
See gh-21986
2020-06-18 11:29:49 +02:00
Andy Wilkinson 9e08490522 Merge branch 'gh-21271'
Closes gh-21271
2020-06-16 12:52:17 +01:00
Andy Wilkinson 753bea64c6 Enable varargs compilation warnings
See gh-21271
2020-06-16 12:50:53 +01:00
Andy Wilkinson 9636350b0b Enable rawtypes compilation warnings
See gh-21271
2020-06-16 12:50:50 +01:00
Andy Wilkinson 056d5f3120 Enable deprecation compilation warnings
See gh-21271
2020-06-16 12:50:47 +01:00
Andy Wilkinson 07fb4b065d Merge branch '2.3.x'
Closes gh-21940
2020-06-16 10:10:38 +01:00
Andy Wilkinson 0de466e06e Require dependency on s-b-dependencies to use its constraints
Previously, Spring Boot's modules published Gradle Module Metadata
(GMM) the declared a platform dependency on spring-boot-dependencies.
This provided versions for each module's own dependencies but also had
they unwanted side-effect of pulling in spring-boot-dependencies
constraints which would influence the version of other dependencies
declared in the same configuration. This was undesirable as users
should be able to opt in to this level of dependency management, either
by using the dependency management plugin or by using Gradle's built-in
support via a platform dependency on spring-boot-dependencies.

This commit reworks how Spring Boot's build uses
spring-boot-dependencies and spring-boot-parent to provide its own
dependency management. Configurations that aren't seen by consumers are
configured to extend a dependencyManagement configuration that has an
enforced platform dependency on spring-boot-parent. This enforces
spring-boot-parent's version constraints on Spring Boot's build without
making them visible to consumers. To ensure that the versions that
Spring Boot has been built against are visible to consumers, the
Maven publication that produces pom files and GMM for the published
modules is configured to use the resolved versions from the module's
runtime classpath.

Fixes gh-21911
2020-06-16 08:50:21 +01:00
Stephane Nicoll 164a992d6e Fix assertion for startup info format
See gh-21926
2020-06-15 20:17:07 +02:00
Phillip Webb 9eb251a8f3 Merge branch '2.3.x'
Closes gh-21904
2020-06-12 10:50:46 -07:00
Phillip Webb 1604545727 Ensure AvailabilityChangeEvent carries generics
Update `AvailabilityChangeEvent` to be a `PayloadEvent` and ensure
that the `getResolvableType` method returns a generic compatible
result.

Prior to this commit, a ClassCastExeption would be thrown if the
following event listener was declared:

  @EventListener
  void onEvent(AvailabilityChangeEvent<ReadinessState> event) {
    ...
  }

Closes gh-21898
2020-06-12 10:50:00 -07:00
Phillip Webb bb7936a000 Merge branch '2.3.x'
Closes gh-21896
2020-06-11 14:52:34 -07:00
Phillip Webb 069d2769f4 Reinstate disabled Reactor Netty test
Reinstate test now that we are on a reactor-netty releases that fixes
reactor/reactor-netty issue 1093.

Closes gh-21437
2020-06-11 14:52:21 -07:00
Madhura Bhave fc9760ba49 Merge branch '2.3.x'
Closes gh-21894
2020-06-11 11:49:06 -07:00
dreis2211 469dfc285b Fix deprecation in NettyRSocketServerFactoryTests
See gh-21872
2020-06-11 11:46:11 -07:00
Phillip Webb 087c62d34b Merge branch '2.3.x' 2020-06-10 22:14:44 -07:00
Phillip Webb 3b71403b99 Merge branch '2.2.x' into 2.3.x 2020-06-10 22:14:33 -07:00
Phillip Webb ac197be815 Fix checkstyle issue 2020-06-10 22:14:09 -07:00
Phillip Webb aecd13bb9b Merge branch '2.3.x' 2020-06-10 22:06:03 -07:00
Phillip Webb 7e5d6bafa8 Merge branch '2.2.x' into 2.3.x 2020-06-10 22:05:40 -07:00
Phillip Webb 02bfc9d30a Polish 2020-06-10 21:50:17 -07:00
Madhura Bhave f96a2f2b83 Merge branch '2.3.x'
Closes gh-21881
2020-06-10 18:52:32 -07:00
Madhura Bhave 83485e625d Merge branch '2.2.x' into 2.3.x
Closes gh-21880
2020-06-10 18:50:41 -07:00
Madhura Bhave 4e014da9e9 Return all loggers for Log4j2
This commit aligns log4j2's behavior with logback such that loggers
with a null configuredLevel are also returned by the actuator endpoint.

Fixes gh-20037
2020-06-10 18:48:14 -07:00
Madhura Bhave 92ce94b3d8 Align default log levels for Log4j2 and Logback
Fixes gh-21293
2020-06-10 18:48:01 -07:00
Andy Wilkinson 6e68101b9f Upgrade to Postgresql 42.2.13
Closes gh-21859
2020-06-10 17:04:03 +01:00
Phillip Webb 621d120ba3 Merge branch '2.3.x'
Closes gh-21735
2020-06-06 12:07:00 -07:00
Phillip Webb c11abf48d9 Polish 'Allow beans without public constructors to load'
See gh-20929
2020-06-06 12:05:50 -07:00
Vlad Kisel d8d8f9cf0b Allow beans without public constructors to load
Allow `BeanDefinitionLoader` to load classes that don't have public
constructors. The constraint was first introduced in d82c50804f to
solve an issue with anonymous Groovy classes but causes particular
problems with `@SpringBootTest`.

See gh-20929
2020-06-06 11:59:47 -07:00
Phillip Webb 5f79bd2a09 Merge branch '2.3.x'
Closes gh-21734
2020-06-06 11:08:30 -07:00
dreis2211 2b5569f054 Polish
See gh-21732
2020-06-06 11:07:21 -07:00
Phillip Webb d356a24a07 Merge branch '2.3.x'
Closes gh-21726
2020-06-05 16:20:39 -07:00
Phillip Webb 47c1928189 Polish 'Optimize SystemEnvironmentPropertyMapper'
Introduce a new `ConfigurationPropertyName.ofIfValid` method to
save us needing to throw and catch an exception unnecessarily.

See gh-21523
2020-06-05 16:11:52 -07:00
dreis2211 0378de7b30 Optimize SystemEnvironmentPropertyMapper
See gh-21523
2020-06-05 16:11:28 -07:00
dreis2211 f8d6d9a4b0 Call append only when necessary
See gh-21523
2020-06-05 16:11:11 -07:00
dreis2211 33deba4948 Use chars rather than strings
Update `SystemEnvironmentPropertyMapper` to use single chars
rather than strings whenever possible.

See gh-21523
2020-06-05 15:52:18 -07:00
Phillip Webb b1044ca883 Update copyright year of changed files 2020-06-05 15:37:47 -07:00
Phillip Webb 8a7a5929ae Merge branch '2.3.x' 2020-06-05 15:37:33 -07:00
Phillip Webb cc50605687 Merge branch '2.2.x' into 2.3.x 2020-06-05 15:36:44 -07:00
Phillip Webb 0a05b4c9fd Update copyright year of changed files 2020-06-05 15:36:09 -07:00
Andy Wilkinson 82cc7e972d Polish "Print the java version being used on startup"
See gh-21559
2020-06-05 14:19:15 +01:00
dreis2211 731c192817 Print the java version being used on startup
See gh-21559
2020-06-05 14:12:08 +01:00
dreis2211 85a6686cae Add Java 15 to JavaVersion enum
See gh-21691
2020-06-05 14:08:09 +01:00
Phillip Webb 4d37430bfe Use servlet context that can access classloader
Update `SpringBootServletInitializer` to use the `ServletContext` that
was provided to the initial `onStartup` call rather than the
one from the `ServletContextEvent`. This allows the `getClassLoader()`
call to complete without throwing an `UnsupportedOperationException`.

Fixes gh-21684
2020-06-03 19:18:12 -07:00
Phillip Webb e39d7971fb Merge branch '2.2.x' into 2.3.x 2020-06-02 22:48:01 -07:00
Phillip Webb 864daab03a Merge branch '2.1.x' into 2.2.x 2020-06-02 22:47:41 -07:00
Phillip Webb b5fe3c3494 Refine YAML type restriction error
Closes gh-21596
2020-06-02 22:46:47 -07:00
Phillip Webb ebb3f5f286 Merge branch '2.2.x' into 2.3.x
Closes gh-21660
2020-06-02 22:28:39 -07:00
Phillip Webb 4fc0dec6c4 Support wrapped random property sources
Update `SpringConfigurationPropertySource` so that wrapped random
property sources can be used. It's assumed that wrapped random
sources will use the name of the source as the prefix.

Closes gh-21595
2020-06-02 22:22:40 -07:00
Phillip Webb 2589f980d5 Merge branch '2.2.x' into 2.3.x
Closes gh-21655
2020-06-02 10:58:36 -07:00
Phillip Webb 09a47c9aad Fix containsDescendantOf for random sources
Fix the `containsDescendantOf` logic for random property sources to
ensure that ancestors are correctly matched.

Closes gh-21654
2020-06-02 10:57:48 -07:00
Phillip Webb 4dff0beb80 Merge branch '2.2.x' into 2.3.x
Closes gh-21645
2020-06-01 15:07:26 -07:00
Phillip Webb 14e6c734a9 Merge branch '2.1.x' into 2.2.x
Closes gh-21643
2020-06-01 14:45:39 -07:00
Phillip Webb 95031295b9 Restore TomcatReactiveWebServerFactoryTests
Restore tests that were previously ignored due to a framework bug.

Closes gh-19702
2020-06-01 14:19:20 -07:00
Phillip Webb a84b7bccf1 Merge branch '2.2.x' 2020-05-27 19:19:51 -07:00
Phillip Webb 14c9804c5c Fix checkstyle issues 2020-05-27 19:19:11 -07:00
Phillip Webb 1c3f147c1e Merge branch '2.2.x'
Closes gh-21598
2020-05-27 16:47:40 -07:00
Phillip Webb af90604030 Merge branch '2.1.x' into 2.2.x
Closes gh-21597
2020-05-27 16:45:08 -07:00
Phillip Webb 587b840666 Restrict use of custom YAML types
Update `YamlJsonParser` and `OriginTrackedYamlLoader` to ensure that
custom types cannot be loaded.

Closes gh-21596
2020-05-27 16:36:46 -07:00
Andy Wilkinson f17f1255a4 Do not change availability on close unless context is active
Previously, an AvailabilityChangeEvent was published when the servlet
and reactive web server application contexts were closed, irrespective
of whether or not the context was active. This caused problems when
the context was not active due to a refresh failure as the event
publication could then trigger bean creation and post-processing that
relied upon beans that had been destroyed when cleaning up after the
refresh failure. The most commonly seen symptom was a missing
importRegistry bean that is required by ImportAwareBeanPostProcessor.

This commit updates the two web server application contexts to only
publish the availability change event if the context is active.

Fixes gh-21588
2020-05-27 20:05:45 +01:00
Stephane Nicoll 4317b29b9a Tolerate change in method format
This commit polishes the assertions of the NoSuchMethodError failure
analyzer as the method format changes according to the JDK.

See gh-21587
2020-05-27 15:25:50 +02:00
Stephane Nicoll 35121f182e Harmonize Period conversion support
Closes gh-21574
2020-05-27 14:48:32 +02:00
Andy Wilkinson 744b4d7c26 Include type hierarchy in NoSuchMethodError failure analysis
Closes gh-21587
2020-05-27 11:00:10 +01:00
Stephane Nicoll b21c09020d Polish "Polish duration support javadoc"
See gh-21579
2020-05-26 18:21:18 +02:00
OrangeDog 1a87fce416 Polish duration support javadoc
See gh-21579
2020-05-26 18:12:11 +02:00
dreis2211 62deec715f Avoid allocations in ConfigFileApplicationListener
See gh-21509
2020-05-20 17:38:17 -07:00
Scott Frederick c5fd09d06d Merge branch '2.2.x'
Closes gh-21522
2020-05-20 13:00:30 -05:00
Scott Frederick 4a812fc29c Fix log name in ServletWebServerApplicationContext
Fixes gh-21354
2020-05-20 12:59:13 -05:00
Andy Wilkinson beb7cb4b81 Preserve property ordering in SpringIterableConfigurationPropertySource
Fixes gh-21470
2020-05-18 15:16:10 +01:00
wonwoo 25723be26f Polish
See gh-21481
2020-05-18 12:22:13 +01:00
Andy Wilkinson d0f16d6fe6 Merge branch '2.2.x'
Closes gh-21450
2020-05-14 12:53:04 +01:00
Andy Wilkinson b78e4dacec Work around file handle leak when Undertow is stopped
There's a bug in Undertow that means it may leak a file handle is
the server is stopped immediately after a response to an SSL request
has been received. The stop processing races with Undertow's SSL
support tidying things up after sending the response. When the stop
processing wins, the tidying up fails with a NullPointerException that
prevents an input stream from being closed. On Windows, the input
stream remaining open prevents JUnit from being able to clean up its
temporary directory.

This commit uses Awaitility to wait for the file that's being served
over SSL to be deleted before stopping the server. On Windows, this
will delay the stop processing from beginning until after the tidy up
that's performed after sending the response has been completed,
hopefully eliminating the race condition that resulted in the input
stream being left open.

Fixes gh-21172
2020-05-14 12:45:37 +01:00
Phillip Webb 038ae93406 Update copyright year of changed files 2020-05-13 16:48:51 -07:00
Phillip Webb 12381467da Polish 2020-05-13 16:48:51 -07:00
Andy Wilkinson 8b6cdbb977 Deregister JDBC drivers when deployed war's ServletContext is destroyed
Closes gh-21221
2020-05-13 17:46:37 +01:00
Andy Wilkinson 4169724b86 Disable test that is flaky due to Reactor Netty problem
See gh-21437
2020-05-13 14:59:05 +01:00
Phillip Webb 0607af870d Improve ConfigurationPropertySource performance
Further improve the performance of `containsDescendantOf` by using
a Map to limit the number of candidates that need checking.

Closes gh-21416
2020-05-12 20:17:06 -07:00
Phillip Webb 4af6e7ff99 Improve ConfigurationPropertySource performance
Attempt to improve the performance of the `ConfigurationPropertySource`
adapters `containsDescendantOf` method. The method now operates on
arrays rather than iterators and reduces the inner for-loop when
possible.

See gh-21416
2020-05-12 16:44:57 -07:00
Andy Wilkinson 4c4097a29b Address flakiness in TomcatServletWebServerFactoryTests 2020-05-12 22:41:56 +01:00
Andy Wilkinson 8cf56069d2 Allow more time for shutdown result callback to be received
5 seconds isn't always sufficient, particularly on CI where the timing
can be quite variable.
2020-05-12 22:25:41 +01:00
Andy Wilkinson 86e6ec04b2 Fix hang caused by race condition in test for reset of kept-alive connection
Previously, a race between the server starting to reject requests
on a kept-alive connection and the request reaching the blocking
servlet could result in a response never being sent.

This commit updates the test to disable blocking once graceful
shutdown with an in-flight request has being. Awaitility is then used
to make a request on an idle kept-alive connection until it fails
due to the connection reset. This may not happen immediately due to
the aforementioned race.
2020-05-12 22:10:23 +01:00
Andy Wilkinson 240898121f Use SmartLifecycle for graceful web server shutdown
Closes gh-21325
2020-05-12 19:59:52 +01:00
Andy Wilkinson c42571ba40 Consolidate Undertow WebServers and simplify their constructors
Closes gh-21391

Co-authored-by: Phillip Webb <pwebb@pivotal.io>
2020-05-12 19:59:52 +01:00
Stephane Nicoll a6efe77a0c Polish "Calculate hashCode only once in ConfigurationPropertyName"
See gh-21394
2020-05-12 13:10:03 +02:00
Stephane Nicoll dd053074f8 Polish "Calculate hashCode only once in ConfigurationPropertyName"
See gh-21394
2020-05-12 10:05:32 +02:00
dreis2211 c9f6a126b7 Calculate hashCode only once in ConfigurationPropertyName
See gh-21394
2020-05-12 10:02:45 +02:00
Scott Frederick 158933c3e5 Improve API of ErrorAttributes and DefaultErrorAttributes
This commit improves the backward-compatibility of the ErrorAttributes
interfaces by providing a default implementation of a new method. It
also encapsulates several parameters that control the inclusion or
exclusion of error attributes into a new ErrorAttributeOptions type to
make it easier and less intrusive to add additional options in the
future. This encapsulation also makes the handling of the
includeException option more similar to other options.

Fixes gh-21324
2020-05-11 15:36:24 -05:00
Phillip Webb 7afd25fc9a Add ConfigurationPropertyCaching support
Add a `ConfigurationPropertyCaching` utility interface that can be
used to control the property source caching.

Prior to this commit, a `ConfigurationPropertySource` that was backed
by a mutable `EnumerablePropertySource` would need to call the
`getPropertyNames()` method each time a property was accessed. Since
this this operation can be expensive, we now provide a way to cache
the results for a specific length of time.

This commit also improves the performance of immutable property sources
by limiting the number of candidates that need to be searched.
Previously, all mapped names would be enumerated. Now, mappings are
grouped by `ConfigurationPropertyName`. This is especially helpful when
the `ConfigurationPropertyName` isn't mapped at all since the hash based
map lookup will be very fast and the resulting mappings will be empty.

Closes gh-20625
2020-05-07 15:22:24 -07:00
Phillip Webb 85e9a73e85 Add hashcode support to ConfigurationPropertyName
Provide a hashcode implementation for `ConfigurationPropertyName` so
that instances can be stored in Map without them all ending up in the
same bucket.

See gh-20625
2020-05-07 15:22:20 -07:00
Phillip Webb 5309912927 Test large property source performance
Add a test to ensure that a large number of property sources that each
contain many items can perform well.

See gh-20625
2020-05-07 15:22:10 -07:00
Phillip Webb 81058cab03 Allow clash in spring.config.name
Remove the recently added slash restriction since Spring Cloud
Config Server needs to support names with slashes.

See gh-21217
2020-05-07 07:56:01 -07:00
Phillip Webb 559c178637 Simplify regex expressions 2020-05-07 07:44:31 -07:00
Madhura Bhave 01404aa27b Merge branch '2.2.x'
Closes gh-21343
2020-05-06 16:00:24 -07:00
Madhura Bhave f29bce657e Harmonize default for server.tomcat.use-relative-redirects
Prior to this commit, the property was a Boolean with a null default.
If it was explicitly set by the user, a context customizer would use
that value to set it on the context. However, if it was not set, the default
wouldn't be tomcat's default but `false` because it was explicitly set to
`false` in `TomcatServletWebServerFactory`. This commit defaults the property
itself to `false` so that the default is more obvious to the user.

Fixes gh-20796
2020-05-06 15:54:27 -07:00
Madhura Bhave be7fe85b55 Polish 2020-05-06 15:35:44 -07:00
Phillip Webb b4963d2463 Fix legacy environment names in isAncestorOf
Fix the `SystemEnvironmentPropertyMapper.isAncestorOf` implementation
to convert names based on their dashed form and to silently ignore
any invalid results.

Closes gh-14479
2020-05-06 11:35:39 -07:00
Andy Wilkinson e03cb94190 Merge branch '2.2.x'
Closes gh-21327
2020-05-06 12:55:08 +01:00