NettyReactiveWebServerFactoryTests.portInUseExceptionIsThrownWhenPortIsAlreadyInUse
started failing on CI following this change in reactor netty:
e6634c27f6
Instead of a `BindException`, a `NativeIoException` is thrown. Since that Exception
is for internal use only, we throw a generic `WebServerException`
instead of the `PortInUseException`.
This commit excludes `com.rabbitmq:http-client` from `spring-rabbit` as
the former brings spring webflux for an optional feature. This also
prevents Spring Boot to consider that a web server should be started as
all the necessary pieces are unexpectedly present.
Closes gh-12853
While being able to exclude all artifacts of a given group is a handy
feature, excluding all artifacts with a given artifactId does not make
much sense as it should refer to a single artifact anyway. Also the
general "exclude" mechanism is meant to do the exact same thing.
Closes gh-12885
For tomcat, if an SslStoreProvider is configured,
`SslStoreProviderUrlStreamHandlerFactory` stores the keyStore with an
empty password. Previously, if a password was supplied using the
ssl.key-store-password property, that would be the password used to
load the keystore and the connector would fail with a
"Password verification failed" exception.
Fixes gh-11391
Since https://jira.spring.io/browse/SPR-16624, the contract for
`ContentNegotiationStrategy` has been refined and should never return an
empty list if it's got no preference for a media type, but it should
rather respond with a `"*/*"` instead.
This commit fixes the `OptionalPathExtensionContentNegotiationStrategy`
defined in the Spring MVC auto-configuration to have that behavior.
Fixes gh-12900
This commit includes some refactoring of active profiles
processing. Previously, there was a LIFO Queue for adding active
profiles. Profiles that were added last, were processed first.
Because of this reverse ordering, profiles were prepended to the
environment to preserve the order in which they were logged.
This however didn't work for "included" profiles as they were
prepended to the environment even though they were processed after
the active profile. In this commit, profiles are processed in a FIFO manner
and processed as they're found.
Fixes gh-11380
This commit makes sure to respect the MBeanServer#invoke contract by
wrapping any user-defined exception in an MBeanException. Also, any
exception not from the JDK is translated, as it may lead to unexpected
issue on the client if that class isn't present. This is consistent
with our operation result mapping strategy.
Closes gh-10448
As pointed out by Rossen in gh-11514 comments, a handler might commit
the response and then send an error signal in the pipeline. In this
case, adding a callback to `beforeCommit` is useless because it won't be
triggered. In those cases, we need to collect metrics right away.
This commits make sure that the Quartz auto-configuration no longer
associates an `Executor` bean if present in the context as Quartz offers
properties to tune it, which would mutate and lead to unexpected
results.
Closes gh-12823
Spring Boot now deploys both annotation-based and functional endpoints
under the same `HttpHandler`; this means the currently auto-configured
`MetricsWebFilter` is instrumenting all endpoints to produce metrics.
There is no need for a WebFlux functional specific support.
This commit removes mentions of `RouterFunctionMetrics` in the docs and
deprecates that class.
Closes gh-12833
Prior to this commit, the metrics `WebFilter` would handle exceptions
flowing through the pipeline and extract tag information right away.
Since error handling turns the exception information into error HTTP
responses later in the chain, the information extracted from the
response earlier is invalid.
In this case, the "status" information could be "200" whereas error
handlers would later set that status to "500".
This commit delays the tags extraction later in the process, right
before the response is comitted. The happy path is not changed, as
handlers signal that the response is fully taken care of at that point.
Fixes gh-11514
Previously to this commit, if a `@ControllerEndpoint`,
`@RestControllerEndpoint` or `@ServletEndpoint` annotated bean was
proxied, the endpoint wasn't properly detected.
This commit makes sure that annotation retrieval works on the user class
while preserving the get (vs. find) retrieval semantic
Closes gh-12441
This commit makes sure that an auto-configuration that requires
`DataSourceProperties` will not break if `DataSourceAutoConfiguration`
has been explicitly excluded.
Closes gh-12512
Update `MeterRegistryConfigurer` to also apply customizers to
composite meter registries. Prior to this commit composites were
skipped due to the incorrect assumption that did not contain
their own state.
Closes gh-12762
This commit ensures that `WebFluxTags` not only relies on
`BEST_MATCHING_PATTERN_ATTRIBUTE` or request URI to provide the "uri"
tag information.
To avoid cardinality explosion, HTTP not found and redirects are
assigned fixed uri tags.
Closes gh-12685
Documentation still refers to the now deprecated `EnvironmentTestUtils`
class instead of `TestPropertyValues` for setting environment values in
tests.
This commit replaces it with `TestPropertyValues` and provides an
equivalent code example.
Closes gh-12711
This commit updates WebTestClientAutoConfiguration to only create a
WebTestClient when running a WebFlux-based application as mocking the
context only works with that mode at the moment.
Closes gh-12318
If two auto-configuration classes with the same name are present,
the conditions report message now uses the fully qualified name for
both instead of the short name.
Fixes gh-11710
Update `AutoConfigurationSorter` so that all `@AutoConfigureBefore` and
`@AutoConfigureAfter` classes are considered even if they are ultimately
not part of the requested set.
Prior to this commit, given classes ordered with annotations such that
A -> B -> C a call to sort only [A, B] could return the incorrect order.
Fixes gh-12660
This commit updates Spring Boot's DeferredImportSelector implementations
to group imports in a consistent set. This makes sure ordering is
applied consistently.
Closes gh-12366
Prior to this commit, `WebMvcTags' would always mark as "NOT_FOUND" or
"REDIRECTION" *any* exchange with responses of 404 and 3xx status, even
if those responses are actually returned by Controller handlers.
This commit checks inverts those checks and first considers if the
"BEST_MATCHING_PATTERN_ATTRIBUTE" request attribute is present and uses
it - then falls back to "NOT_FOUND" and "REDIRECTION" to avoid
cardinality explosion.
Fixes gh-12577
As auto-configuration for Spring Security OAuth has been removed
from Spring Boot 2.0 and Spring Security 5 doesn't have OAuth
2.0 Authorization / Resource Server support yet, it has not
been obvious at all how to implement an OAUth 2.0 server with
Spring Boot 2.0.
For that reason, this new section briefly explains the current
temporary situation and points to the spring-security-oauth2-autoconfigure
module that restores the auto-configuration support for OAuth
2.0 Authorization and Resource Servers.
Closes gh-12491
Update `Map` and `Collection` binders to create a copy of the existing
collection whenever possible. Prior to this commit the binder would
always mutate the existing value and then call the setter with the
same instance. This could cause issues if the setter expected a
different instance.
Fixes gh-12322
Previously, the underlying RandomAccessDataFile was not closed when
the JarFile that was using it was closed. This causes a problem on
Windows as the open file handle prevents the file from being deleted.
This commit updates JarFile to close the underlying
RandomAccessDataFile when it is closed and has a JarFileType of
DIRECT.
Previously, when accessing the manifest of a jar file that maps to a
nested directory (BOOT-INF/classes) a new JarFile was created from the
root jar file, the manifest was retrieved, and the new JarFile was
closed. This could lead to the underlying RandomAccessDataFile being
closed while it was still in use.
This commit improves JarFile to retrieve the manifest from the
existing outer JarFile, thereby avoiding the need to create and close
a new JarFile.
Unfortunately, PropertiesLauncher creates a number of scenarios where
a JarFile with a type of direct is closed while it’s still being used.
To accommodate this behaviour, RandomAccessDataFile has been updated
so that it can re-open the underlying RandomAccessFile if it is used
after it has been closed.
Closes gh-12296
This commit disables the default HTML view in the WebFlux error handling
support when `server.error.whitelabel.enabled=false`.
In this case, the original exception will be forwarded down the stream
and handled by the default `WebExceptionHandler` provided by Spring
WebFlux (likely to respond a blank page and an error HTTP response
status).
Closes gh-12520
Update `SpringConfigurationPropertySources` adapter logic so that and
exact instance match is used when checking if the cache can be used.
Prior to this commit if a property source was replaced with one that
had exactly the same name, the adapted version would not change.
Fixes gh-12451
Even though War deployment is supported by Spring Framework itself for
WebFlux applications, this is not the case currently in Spring Boot.
Fixes gh-12455
This commit fixes 220f8cd and moves the order for
`WelcomePageHandlerMapping` to `2` since the previous order was
conflicting with the resource mapping.
Closes gh-12335
Refactor JSON parser wrappers to remove duplicate code portions in the
parseMap() and parseList() methods by adding an AbstractJsonParser.
See gh-12428
This commit orders the `WelcomePageHandlerMapping` at
`Ordered.LOWEST_PRECEDENCE -1` in order to give a chance to other
mappings to handle the incoming requests.
In this case, developers might provide a custom `ViewController` or
custom `HandlerMapping` for the `"/"` path and we should not override
that opinion.
Closes gh-12335
This commit updates WebTestClientAutoConfiguration to only create a
WebTestClient when running a WebFlux-based application as mocking the
context only works with that mode at the moment.
Closes gh-12318
This commit updates Spring Boot's DeferredImportSelector implementations
to group imports in a consistent set. This makes sure ordering is
applied consistently.
Closes gh-12366
This commit updates the annotation processor and the binder to ignore
any static or abstract method that has the characteristics of a JavaBean
accessor. As a result, no property is generated for those (invalid)
accessor and no binding occurs on them either.
Closes gh-12390
Prior to this commit, all `WebMvcConfigurer` instances provided by user
configuration were processed *before* the one provided by the
`WebMvcAutoConfiguration`.
For many options this has no consequence, but for some, like the
`ContentNegotiationConfigurer`, settings were overriden by the
auto-configuration even if developers provided an opinion.
This commit orders the `WebMvcConfigurer` provided by the
auto-configuration at `0`, so that custom configurers (unordered, at
`Ordered.LOWEST_PRECEDENCE`) are processed *after*.
This still gives room to developers for configuring things *before* the
auto-configuration - they can still order their own configuration
accordingly.
Fixes gh-12389
This commit fixes the binder so that it property identifies JavaBean
accessors. Previously an accessor named `get` or `is` was identified.
Similarly, a setter named `set` was identified.
Closes gh-12363
This commit defers the resolution of the default ddl auto mode only when
it is absolutely necessary. This prevents Spring Boot to attempt to get
a connection when it isn't necessary
Closes gh-12374
Previously, when performing lazy initialisation of the context,
ApplicationContextRequestMatcher assigned the context field before it
called initialized. The context being non-null is used as the signal
that it’s ok to call a subclass’s matches method. If one thread checks
for a non-null context in between the field being assigned and
initialized being called on another thread, matches will be called
before the subclass is ready.
This commit closes the window for the race condition by only assigning
the context field once the subclass’s initialized method has been
called.
There is a secondary problem in each of the subclasses. Due to the use
of double-checked locking in ApplicationContextRequestMatcher, it’s
possible for a subclass’s matches method to be called by a thread that
has not synchronised on the context lock that’s held when initialized
is called and the delegate field is assigned. This means that the
value assigned to the field may not be visible to that thread.
This commit declares the delegate field of each
ApplicationContextRequestMatcher subclass as volatile to ensure that,
following initialisation, its value is guaranteed to be visible to
all threads.
Closes gh-12380
This commit detects if a `ConnectionNameStrategy` bean exists in the
context and associates it with the auto-configured RabbitMQ's
`ConnectionFactory` when that is the case.
Closes gh-12367