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
Update the configurable embedded web server factory interfaces to
extend `ConfigurableWebServerFactory` so that the can be used in a
`WebServerFactoryCustomizer`.
Extract server specific customization to their own auto-configuration
and align reactive/servlet server auto-configuration.
Closes gh-8573
This commits move the Hikari metrics registration to a BeanPostProcessor
as the Hikari datasource cannot be modified once its configuration has
been sealed (usually happens when `getConnection` is invoked on the
pool).
Closes gh-12129
HikariCP has metrics integration with Micrometer. This configures all
`HikariDataSource` beans with the `MicrometerMetricsTrackerFactory` if a
`MeterRegistry` is available.
See gh-12129
Create a new `ApplicationConversionService` similar in design to the
DefaultFormattingConversionService from Spring Framework. The new
conversion service provides a central place for custom conversion logic
supported by Spring Boot.
Also replace the `BindingConversionService` with an internal
`BindConverter` class that now invokes the `SimpleTypeConverter`
directly. Binding for `@ConfigurationProperties` has been updated so
that any custom property editors registered with the BeanFactory can
be used.
Fixes gh-12095
This commit adds micrometer's default values for each monitoring
system with tests that validate those defaults are consistent. This
makes sure that those defaults are part of the metadata and any tooling
support that uses it.
Closes gh-12089
Remove custom `SpringIntegrationMetrics` and instead provide
auto-configuration to the direct Micrometer support added in Spring
Integration 5.0.2.
Closes gh-11985
Previously, links were only provide to web endpoints. This commit
expands link resolution to also provide links for servlet endpoints,
controller endpoints, and rest controller endpoints.
Closes gh-11902
Refactor `*ExportConfiguration` classes to be regular auto-configuration
classes.
Also removed the `@ConditionalOnProperty` guards for `.enabled` properties
since auto-configuration can now be excluded in the usual way. Enabled
properties remain where applicable and are adapted for Micrometer to use
as it sees fit.
Fixes gh-11838
Add a new `WebServerApplicationContext` interface that provides a common
abstraction for all application contexts that create and manage the
lifecycle of an embedded `WebServer`.
Allows server namespaces to become a first-class concept (rather
subverting `ConfigurableWebApplicationContext.getNamespace()`) and
allow us to drop `getServerId()` from `WebServerInitializedEvent`.
Also helps to improve `ManagementContextAutoConfiguration` and
`ManagementContextFactory`.
Fixes gh-11881
Add MeterFilter to restrict the maximum number of web client URI tags
created. Prior to this commit, if a user was manually building URIs for
use with a RestTemplate (rather than using uriVariables) the JVM could
run out of memory.
Fixes gh-11338
Co-authored-by: Phillip Webb <pwebb@pivotal.io>
Update micrometer auto-configuration so that a `CompositeMeterRegistry`
is only created when more than one `MeterRegistry` bean is declared.
When a composite is crated, it is marked as `@Primary` so that it
can be directly injected. Meter registries can now be defined directly
as beans, and auto-configuration can back off in the usual way.
The `MeterRegistryConfigurer` is now called `MeterRegistryCustomizer`
and is generically types so it's easy to apply customizations to a
particular `MeterRegistry` implementation.
Fixes gh-11799
Co-authored-by: Jon Schneider <jschneider@pivotal.io>
Previously, the test in MetricsAutoConfigurationIntegrationTests was
testing the functionality of WebMvcMetricsFilter to verify that the
auto-configuration had registered the filter for async dispatches.
This test was complex and covered the same code as a test in
WebMvcMetricsFilterTests.
This commit reworks the test to examine the dispatcher types on the
filter registration directly instead.
Closes gh-11826