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
Spring Integration no longer requires a `MicrometerMetricsFactory` to
support Micrometer metrics so there's nothing for Boot to
auto-configure.
See gh-12287
Update `EndpointRequest` to that the `PathMappedEndpoints` bean is
optional. A missing bean is treated as if there are no path mapped
endpoints.
Fixes gh-12238
Update `ApplicationContextRequestMatcher` and
`ApplicationContextServerWebExchangeMatcher` to use a supplier for
the context, rather than the context itself.
This allow exceptions to be propagated to subclasses which may choose
to deal with them.
See gh-12238
Update `spring-boot-actuator-autoconfigure` so that it no longer has
a dependency on `spring-boot-test-autoconfigure`. This will allow us to
add test support for actuator concerns in the future if we need to.
Fixed gh-12270
This commit changes invocations to immediately return the expression
instead of assigning it to a temporary variable. The method name should
be sufficient for callers to know exactly what will be returned.
Closes gh-12211