Add an `DispatcherServletPath` interface which provides a much more
consistent way to discover the path of the main dispatcher servet.
Prior to this commit, auto-configurations would often make use of the
`ServerProperties` class to discover the dispatcher servlet path. This
mechanism isn't very explicit and also makes it hard for us to relocate
that property in Spring Boot 2.1.
This commit also reverts most of fddc9e9c7e since it is now clear that
the supporting multiple dispatcher servlet paths will be much more
involved that we originally anticipated.
Closes gh-13834
As of Spring Framework 5.1, we're depending on the Reactor Californium
release train.
Reactor Netty is now at version 0.8 and changed its artifact
coordinates, package names and broke several APIs. Spring Framework is
now up-to-date with those changes and this commit does the same for
Spring Boot.
Note that in that process, the `NettyServerCustomizer` has been changed
since the former `HttpServerOptions.Builder` API is now gone from
Reactor Netty, and we're now relying on immutable server instances
instead of a stateful builder pattern.
See gh-13321
The ConnectionFactory can be used early in user configuration to
configure an `Exchange`. Such connection may not hold the proper
MetricCollector and can be cached, leading to missed metrics
information.
This commit moves the configuration of RabbitMQ metrics to a
BeanPostProcessor so that the proper MetricCollector is configured
before any connection is created.
Closes gh-12855
This commit improves the `health` endpoint to run health check for a
particular component or, if that component is itself a composite, an
instance of that component.
Concretely, it is now possible to issue a `GET` on
`/actuator/health/{component}` and
`/actuator/health/{component}/instance` to retrieve the health of a
component or an instance of a composite component, respectively.
If details cannot be showed for the current user, any request leads to a
404 and does not invoke the health check at all.
Closes gh-8865
This commit updates the initial proposal to add support for reactive
use cases as well. A reactive application can use
ReactiveHealthIndicatorRegistry as an alternative to
HealthIndicatorRegistry.
Closes gh-4965
This commit introduces HealthIndicatorRegistry which handles
registration of HealthIndicator instances. Registering new
HealthIndicator instances is now possible in runtime.
See gh-4965
Auto-configuration of LDAP's `LdapTemplate` is currently a part of
`LdapDataAutoConfiguration` which is conditional of presence of
`LdapRepository` (i.e. Spring Data LDAP). This arrangement isn't ideal
since the `LdapTemplate` is a part of Spring LDAP project, and therefore
should not be tied to Spring Data LDAP.
This commit improves and simplifies LDAP auto-configuration by moving
`LdapTemplate` configuration to `LdapAutoConfiguration`. Consequently,
`LdapDataAutoConfiguration` is not needed anymore and is removed.
See gh-13136
Previously, when the Jersey-based Actuator was configure with a
separate management port, the resulting child context would fail to
start due to their being no ResourceConfigCustomizer beans available.
This commit updates the configuration so that the customizer's are
injected using an ObjectProvider and an empty list is used in the
event of their being no customizer beans. This aligns the child
context configuration class with JerseyAutoConfiguration which
already used this approach.
Closes gh-12975
This commit improves the initial proposal by providing a by name read
operation that returns the detail of a particular cache. It also adds
more tests and complete API documentation for the feature.
Closes gh-12216
This commits adds an actuator endpoint which lists the caches per
context and cacheManager and provides a delete operation to clear the
caches. As the statistics are exposed via the metrics endpoint they are
not included
See gh-12216
This commit adds support for Actuator Metrics for WebClient.
This support mirrors the current behavior for `RestTemplate`, reusing
the same metric name `"http.client.requests"` and tags.
`WebClient` is instrumented by a `MetricsWebClientFilterFunction` which
is applied by a `WebClientCustomizer`. This instrumentation happens
automatically only if you create an instance of `WebClient` using an
auto-configured `WebClient.Builder` bean.
This infrastructure is reusing de facto the `MeterFilter` that has been
added for `RestTemplate` in order to limit the "uri" tag cardinality.
Closes gh-12228
All Hibernate entityManagerFactories are automatically instrumented
and their statistics are included into Micrometer using its
HibernateMetrics binder.
Closes gh-12550
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
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>