Changes made in f1cfad67 mean that the web-specific extension is no
longer required as the infrastructure now automatically produces a
bad request (400) response when a required query parameter is absent.
See gh-10372
This commit makes sure to automatically scan `Converter` and
`GenericConverter` beans when a test uses `@WebMvcTest` or
`@WebFluxTest`.
Closes gh-10802
Expose key prefix, TTL and null value settings for spring-data-redis'
RedisCacheConfiguration in Spring .properties/yml configuration files.
Example:
spring.cache.redis.ttl=PT15M
spring.cache.redis.keyPrefix=foo
spring.cache.redis.useKeyPrefix=false
spring.cache.redis.cacheNullValues=false
See gh-10795
c719ab7a adding dependency management for a number of Apache Commons
projects to exclude commons-logging and resolve problems with
dependency convergence.
As Boot's dependencies have evolved, much of this dependency
management has become redundant. This commit removes it, and excludes
commons-logging in the single starter that still needs it instead.
Closes gh-7050
Update `SpringConfigurationPropertySource` so that the
`SystemEnvironmentPropertyMapper` is only used for the "actual" system
environment property source. This allows SystemEnvironmentProperySource
class to be used for other purposes (for example, Spring Cloud uses it
to as an override source providing decryption).
Only property sources named `systemEnvironment` or ending with
`-systemEnvironment` now have the `SystemEnvironmentPropertyMapper`
applied. The `TestPropertyValues` has been retrofitted to name the
source it adds appropriately.
Fixes gh-10840
Refine `SystemEnvironmentPropertyMapper` to support environment
variables that would have worked in Spring Boot 1.5. Specifically,
camelCase property bindings now support an additional underscore. The
recommended way to map `fooBar` is still `PREFIX_FOOBAR`, however,
`PREFIX_FOO_BAR` will now also work.
Fixes gh-10873
Refine the binder recursion rules introduced in commit f337323819 so
they only apply to Maps. Recursive List and Array binding is now no
longer allowed. Prior to this commit, binding a List that contained a
reference to itself would fail with a `StackOverflowException` if the
underlying property source was not iterable.
Fixes gh-10702
Upgrade to Micrometer 1.0.0-rc.3 and refactor existing
auto-configuration to align with updated APIs.
Note that Spring MVC instrumentation has now changed from an interceptor
to a Filter.
See gh-10906
Refactor `ReactiveWebApplicationContext` implementations to align closer
with the `WebApplicationContext` implementations defined in
Spring Framework.
The following classes are now provided:
- `AnnotationConfigReactiveWebApplicationContext` -- A refreshable
reactive web context with support for `@Configuration` classes.
- `GenericReactiveWebApplicationContext` -- A non-refreshable reactive
GenericApplicationContext.
- `ReactiveWebServerApplicationContext` -- A non-refreshable reactive
GenericApplicationContext with support for server discovery.
- `AnnotationConfigReactiveWebServerApplicationContext` -- A
non-refreshable reactive `GenericApplicationContext` with support
for `@Configuration` classes and server discovery.
These classes roughly align to the following Servlet equivalents:
- `AnnotationConfigWebApplicationContext` (Spring Framework)
- `GenericWebApplicationContext` (Spring Framework)
- `ServletWebServerApplicationContext` (Spring Boot)
- `AnnotationConfigServletWebServerApplicationContext` (Spring Boot)
An additional `ConfigurableReactiveWebEnvironment` interface as also
been introduced, primarily for `@ConditionalOnWebApplication` to use.
Fixes gh-10852
This commit ensures that all errors handled by the
`DefaultErrorWebExceptionHandler` (Spring WebFlux error convetion
support) logs an error with request information and exception
stacktrace.
This is limited to errors that result in an HTTP 5xx error.
Exceptions that extend `ResponseStatusException` and set a non-5xx
status will not be logged.
Closes gh-10904
This commit enables HTTP/2 support for Tomcat and Undertow, for both
Servlet-based and Reactive applications.
Enabling the `server.http2.enabled` configuration flag is enough with
Undertow.
Tomcat has a few prerequisites:
* Tomcat 8.5 requires JDK8+ and the proper libtcnative version installed
on the host
* Tomcat 9.0.x requires JDK9+
Closes gh-10043
This commit adds a new configuration properties class for configuring
HTTP/2 protocol support.
By default, this protocol is disabled as enabling it requires several
manual changes:
* configuring a web server for proper TLS and ALPN support
* configuring a proper SSL certificate
See gh-10043
This commits adds the AprLifecycleListener as a default
LifecycleListener in order to detect and use automatically the
tomcatnative library if it is available, for SSL support.
This feature can be useful for both performance reasons or for
supporting ALPN when using JDK8.
See gh-10043
Closes gh-9964
Remove extraneous white space and adjusted the length of non-code lines
to be as close to 90 characters (but not over 90 characters) as
possible.
Update a couple things I missed in the editing pass, too.
Closes gh-10897
Remove extraneous white space and adjusted the length of non-code lines
to be as close to 90 characters (but not over 90 characters) as
possible.
Update a couple things I missed in the editing pass, too.
Closes gh-10896
Remove extraneous white space and adjusted the length of non-code lines
to be as close to 90 characters (but not over 90 characters) as
possible.
Update a couple things I missed in the editing pass, too.
Closes gh-10893
Remove extraneous white space and adjusted the length of non-code lines
to be as close to 90 characters (but not over 90 characters) as
possible.
Update a couple things I missed in the editing pass, too.
Closes gh-10892
Provide a `getEnvironment` method in `SpringBootContextLoader` to allow
specialized `ConfigurableEnvironment` implementations to be used.
Closes gh-10740
Update the logback file appender to use `SizeAndTimeBasedRollingPolicy`
rather than `FixedWindowRollingPolicy`.
Add two new properties to improve log file configuration capabilities:
- `logging.file.max-history` to limit the number of archive log files
to keep.
- `logging.file.max-size` to limit the log file size.
See gh-6352
Flyway implicitly adds classpath: to locations without a prefix but
resource loader fails to find migratons on the classpath without the
prefix.
Add an explicit classpath: prefix so that both Flyway and the resource
loader used to check the locations can find the migration location.
See gh-10807
Previously, spring.config.name was handled in such a way that its
value would replace the defaults. By constrast, spring.config.location
would add to the defaults.
Update the handling of spring.config.location so that it replaces the
defaults. This aligns its behaviour with spring.config.name. To allow
users to add additional locations a new property,
spring.config.additional-location, has been introduced. It behaves as
spring.config.location did prior to this change.
Closes gh-10595
The Gradle plugin integration tests find their Gradle build scripts
using a naming convention of ${ClassName}-${methodName}.gradle. This
convention led to two gradle scripts with filenames that were long
enough to causes problems on Windows.
This commit renames two test methods to reduce the length of their
names and, therefore, the names of their corresponding Gradle script
files.
Closes gh-10868
Clean `${revision}` variables when running invoker based integration
tests. Prior to this commit some `${revision}` placeholders remained
in the invoker local repository preventing the project from being built
outside of the reactor.
Fixes gh-10667
Move logic from `ParameterNameMapper` into `ReflectiveOperationInvoker`
in order to reduce the surface area of the public API.
Also rename some classes for consistency.
Instead of looking for the presence of `WebSecurityConfiguration`,
this commit checks for the presence of a `Filter` with the name
springSecurityFilterChain. This allows users to configure the Filter
without adding `WebSecurityConfiguration`, making it more flexible.
`springSecurityFilterChain` is somewhat of a contract in Spring Security
and it relies on the name being `springSecurityFilterChain`.
Closes gh-10849
This commit automatically instruments all available data sources with
a configurable metric name. The instrumentation can be disabled in case
more control is needed.
Closes gh-10295
Previously, the configuration metadata annotation processor relied
upon an additional metadata file have been copied to an output
location. When building with Gradle, it's the processResources task
that performs this copy and there is no guarantee that it will have
run before the compileJava task unless an explicit dependency betwee
the two tasks has been configured. If a project is built using
Gradle's parallel build support, the likelihood of this required
ordering not occurring increases.
This commit updates the configuration metadata annotation processor to
consider a new annotation processor option when looking for the
additional config metadata file. The Gradle plugin has been updated
to provide this option as a compiler argument. The option is only
provided when the annotation processor is found on the compilation
classpath to avoid a warning from javac's annotation processing about
the use of an option that is not supported by any of the available
annotation processors.
Closes gh-9755
This commit adds a new customizer interface, `NettyServerCustomizer` for
customizing Reactor Netty server instances while they're being built.
Closes gh-10418
Exceptions inside AbstractReactiveHealthIndicator.doHealthCheck()
method, outside of Mono pipeline, could fail whole endpoint
response instead of returning `DOWN` status from indicator.
See gh-10822
This commit updates `WebFluxSecurityConfiguration` to look for a
`WebFilterChainProxy` rather than the default configuration that
`@EnableWebFluxSecurity` triggers. The latter is now package private.
Previously, ConfigurationPropertiesBindingPostProcessor had a number
of setter methods that implied that its configuration was more mutable
than it actually is and would only have an effect when called early
on in the post-processor's lifecycle.
This commit clarifies how the post-processor can be configured by
removing the misleading setters.
Closes gh-10598
Previously, configuration properties binding would only see changes to
the environment if there was no PropertySourcesPlaceholderConfigurer
in the context. This happened because
PropertySourcesPlaceholderConfigurer wrapped the Environment in a
PropertySource, effectively hiding it from the change tracking
performed by SpringConfigurationPropertySources.
This commit updates ConfigurationPropertiesBindingPostProcessor so
that it ignores the environment property source contained by
PropertySourcesPlaceholderConfigurer and uses a composite of
the PropertySourcesPlaceholderConfigurer's other property sources and
the Environment's PropertySources instead.
Since Kotlin extensions do not apply to static
methods, this commit introduces a runApplication()
Kotlin top level function that acts as a Kotlin
shortcut for SpringApplication.run().
This shortcut avoids to require using non-idiomatic
code like SpringApplication.run(FooApplication::class.java)
and provides a runApplication<FooApplication>() alternative
(as well as an array of KClass based alternative when
multiple classes need to be passed as parameter).
It is possible to customize the application with the
following syntax:
runApplication<FooApplication>() {
setEnvironment(environment)
}
See gh-10511
This commit adds Kotlin main artifacts to Spring
Boot dependency management and will be replaced by
Kotlin BOM when it will be available (see KT-18398).
See gh-9486
This commit renames spring.datasource.initialize to
spring.datasource.initialization-mode and use the
DataSourceInitializationMode enum. By default, only an embedded
datasource is initialized.
Closes gh-10773
This commit introduces a endpoints.<id>.web.path generic property that
allows to customize the path of an endpoint. By default the path is the
same as the id of the endpoint.
Such customization does not apply for the CloudFoundry specific
endpoints.
Closes gh-10181
This commit makes sure that the `replyTemplate` is set if a
KafkaTemplate is available in the context which effectively add support
for `@SendTo`.
Closes gh-10669
When building a flattened map, the YamlProcessor from
Spring Framework, converts a null value to an empty string.
We want the null value to also keep track of its origin,
which is why this commit creates an `OriginTrackedValue`
for an empty string if the original value is null.
Fixes gh-10656
This commit removes the cleanup of the javax.validator.Validator that
can be created to validate @ConfigurationProperties binding as the
memory effect can no longer be reproduced.
Closes gh-10573
Following some changes in the latest snapshot this includes:
- Some updates to oauth2 client auto-config
- Security auto-config no longer relies on GlobalAuthenticationConfigurerAdapter
- Remove reactive security starter
Closes gh-10704
Regardless of whether the web endpoints have been enabled or not,
all endpoints for which beans are created need to be exposed in a
CF environment under /cloudfoundryapplication.
Closes gh-10673
This commit introduces a new mainClassName property on the springBoot
DSL provided by the Gradle plugin. It can be used to explicitly
configure the mainClassName of the default bootRun, bootJar, and
bootWar tasks in a single place. Previously, the only mechanism
provided to do so was the mainClassName property that's only available
when the application plugin has been applied.
Closes gh-10623
Previously, BootRun used the main property to configure the name of
the main class to run while BootJar and BootWar used the mainClass
property. Both were different to the application plugin which provides
a mainClassName project property.
This commit updates BootRun, BootJar, and BootWar to change the name
of the property used to configure the name of the main class to be
mainClassName. This makes the three Boot-specific tasks consistent
with each other, and also aligns them with Gradle's own application
plugin.
Closes gh-10622
Previously, we relied on Mockito's internals to bypass any Spring AOP
proxy during verification of a spy. Thanks to a new API in Mockito,
we can replace the use of Mockito's internals with a
VerificationStartedListener. This listener changes Mockito's view of
the mock to be the ultimate target of the AOP proxy, i.e. to be the
actual Mockito-created spy, allowing Mockito's verification of the
spy to proceed successfully.
This above-described change will mean that we require a very
up-to-date version of Mockito so the tests that verify our
compatibility with 2.5 have been removed as we will no longer support
it when using @MockBean or @SpyBean.
Lastly, two tests have been updated to replace their usage of the
internal MockUtil class with the equivalent public API calls.
Closes gh-10352
Previously, the media types that are consumed and produced by
endpoints were configured in the web stack-specific configuration.
Furthermore, these configured media types were not used for the
discovery "endpoint" that links to all the available endpoints.
This commit introduces EndpointMediaTypes that is configred in a
single, central location and then used to configure the consumed and
produced media types for endpoints exposed via WebFlux, Web MVC, and
Jersey as well as the discovery "endpoint" provided by each.
Closes gh-10659
Starting with Hibernate 5.2.10, the JPA property
`hibernate.connection.provider_disables_autocommit` should be set to true
when the datasource has autocommit disabled in order to improve
performance.
See gh-9737
The current documentation references mechanisms for OpenShift 2, which
has been changed significantly with the latest releases, specifically the
OpenShift 3 release.
Closes gh-10609
This commit adds support for Spring Boot error conventions with WebFlux.
The Spring MVC support for that is based on an `Controller` that's
mapped on a specific `"/error"` path and configured as an error page in
the Servlet container. With WebFlux, this support leverages a
`WebExceptionHandler`, which catches exceptions flowing through the
reactive pipeline and handles them.
The `DefaultErrorWebExceptionHandler` supports the following:
* return a JSON error response to machine clients
* return error HTML views (templates, static or default HTML view)
One can customize the error information by contributing an
`ErrorAttributes` bean to the application context.
Spring Boot provides an `ErrorWebExceptionHandler` marker interface and a
base implementation that provides high level constructs to handle
errors, based on the Spring WebFlux functional flavor.
The error handling logic can be completely changed by providing a custom
`RouterFunction` there.
Fixes gh-8625
Update `Binder` so that Maps containing references to themselves may
be bound. The existing stack-overflow protection (required when binding
a bean to a non enumerable source) now only applies to bean properties.
Fixes gh-9801
- New repeatable tag query parameter to refine a query by one or more
tag key/value pairs.
- Selecting a metric by name (and optionally a set of tags) reports
statistics that are the sum of the statistics on all time series
containing the name (and tags).
Closes gh-10524
Travis is terminating builds as they are producing too much logging.
A major contributor to the volume of logging is the Gradle plugin's
build. This commit switches off debug logging for the build and
enables test event logging. This considerably reduces the volume of
logging that is produced while still providing some insight into the
build's tests.
Update `LoggingMainClassTimeWarningListener` to import individual
`Layout` inner classes. This fixes an odd javac parse issue that
otherwise occurs.
See gh-9316
Move projects to better reflect the way that Spring Boot is released.
The following projects are under `spring-boot-project`:
- `spring-boot`
- `spring-boot-autoconfigure`
- `spring-boot-tools`
- `spring-boot-starters`
- `spring-boot-actuator`
- `spring-boot-actuator-autoconfigure`
- `spring-boot-test`
- `spring-boot-test-autoconfigure`
- `spring-boot-devtools`
- `spring-boot-cli`
- `spring-boot-docs`
See gh-9316