Previously, environment binding always happened in a post processor once
the bean has been created. Constructor binding requires to perform the
binding at creating time so this commit performs binding at creation
time if possible.
When this happens, a special `ConfigurationPropertiesBeanDefinition` is
created with a supplier that invokes the binder. To avoid a case where
a bean is processed twice, the post-processor now ignores any bean that
has already been bound to the environment.
Closes gh-8762
Co-authored-by: Madhura Bhave <mbhave@pivotal.io>
This commit adds the newly introduced `@ConditionalOnExposedEndpoint`
conditional annotation to all auto-configured `Endpoint` in Actuator.
With that change, `EndPoint` instances and related infrastructure will
only be created when they are meant to be exposed and used. This will
save CPU and memory resources when Actuator is present.
Closes gh-16093
Prior to this commit, Actuator `Endpoint` instantiations would be
guarded by `@ConditionalOnEnabledEnpoint` condition annotations. This
feature saves resources as disabled endpoints aren't unnecessarily
instantiated.
By default, only `"health"` and `"info"` endpoints are exposed over the
web and all endpoints are exposed over JMX.
As of gh-16090, JMX is now disabled by default. This is an opportunity
to avoid instantiating endpoints if they won't be exposed at all, which
is more likely due to the exposure defaults.
This commit adds a new `@ConditionalOnExposedEndpoint` conditional
annotation that checks the `Environment` for configuration properties
under `"management.endpoints.web.exposure.*"` and
`"management.endpoints.jmx.exposure.*"`. In the case of JMX, an
additional check is perfomed, checking that JMX is enabled first.
The rules implemented in the condition itself are following the ones
described in `ExposeExcludePropertyEndpointFilter`.
See gh-16093
This commit switches the default value for the `spring.jmx.enabled`
configuration property.
JMX is now disabled by default and can be enabled with
`spring.jmx.enabled=true`.
Closes gh-16090
This commit splits the management context configuration for jersey
into two separate configurations depending on if the type is SAME or
CHILD. The configuration for the SAME context should only kick in if
there is no existing ResourceConfig bean.
Fixes gh-15891
This commit also ensures that Jersey-based actuator endpoints are
available before the user has configured a `ResourceConfig` bean
Fixes gh-15625
Fixes gh-15877
Previously, MeterRegistryPostProcessor would trigger the creation of all
meter binders and meter registry customizers before applying the
customizers and calling the binders. In some situations with complex
dependency graphs where the creation of a binder and the injection of
its dependencies inadvertently triggered some meter binding, this
could result in meters being bound before the registry had been
customized.
This commit reworks MeterRegistryPostProcessor and MeterRegistryConfigurer
to defer the retrieval of registry customizers and meter binders until
just before they are needed. As a result, customizers are now retrieved
and applied before the binders are retrieved.
Closes gh-15483
This commit adds `ElasticsearchRestHealthIndicator`, a new
`HealthIndicator` for Elasticsearch, using the Elasticsearch "low level
rest client" provided by the
`"org.elasticsearch.client:elasticsearch-rest-client"` dependency.
Note that Spring Boot will auto-configure both low and high level REST
clients, but since the high level one is using the former, a single
health indicator will cover both cases.
See gh-15211
When server and management are at different ports, and when server
requires TLS client authentication, then there is no simple method to
disable TLS client authentication for management port.
This commit adds an additional "none" option to ssl.client-auth.
Example:
server.port=8080
server.ssl.enabled=true
server.ssl.client-auth=need
management.server.port=8081
management.server.ssl.enabled=true
management.server.ssl.client-auth=none
See gh-14985
Complete the restructuring of the security auto-configuration
packages by removing the direct import of web configuration from
the main security auto-configuration.
Closes gh-14412
Update `WebEndpointDiscoverer` and related classes to that multiple
`PathMapper` beans can be registered. Mappers are now tried in order
until one returns a non-null value.
Closes gh-14841
Previously, Couchbase's health was determined by retrieving the bucket info
from the cluster info. This retrieval could take over one minute in some
cases even when Couchbase is health. This latency is too large for a health
check.
The Couchbase team have recommended the of a Cluster#diagnostics instead.
This provides a much lower latency view of the cluster's health. This
commit updates CouchbaseHealthIndicator to use Cluster#diagnostics while
retaining support, in a deprecated form, for the old info-based mechanism
should anyone want to opt back into that in 2.0.x.
Closes gh-14685
Update `MappingWebEndpointPathMapper` to use the lowercase version of
the endpoint ID when no explicit path mapping has been set. An endpoint
with the ID 'myEndpoint' will now be mapped to the path 'myendpoint'.
See gh-14773
Update `ExposeExcludePropertyEndpointFilter` so that mixed case
endpoint IDs are supported. Prior to this commit it was not easy for
an endpoint to be missed by the filter due to the formatting of the
property value.
See gh-14773
Update `OnEnabledEndpointCondition` so that mixed case endpoint IDs
are supported. Prior to this commit an
`InvalidConfigurationPropertyNameException` would be thrown when trying
to enabled or disable an endpoint with a camel case ID.
See gh-14773
Update the endpoint time-to-live binding logic so that mixed case
endpoint IDs are supported. Prior to this commit an
`InvalidConfigurationPropertyNameException` would be thrown when using
a camel case endpoint ID.
See gh-14773
Add an `EndpointID` class to enforce the naming rules that we support
for actuator endpoints. We now ensure that all endpoint names contain
only letters and numbers and must begin with a lower-case letter.
Existing public classes and interfaces have been changes so that String
based `endpointId` methods are deprecated and strongly typed versions
are preferred instead. A few public classes that we're not expecting
to be used directly have been changed without deprecated methods being
introduced.
See gh-14773
Rework Prometheus push gateway support so that the central class can
be used outside of auto-configuration. The shutdown flags have also
been replaced with a single "shutdown-operation" property since it's
unlikely that both "push" and "delete" will be required.
It's also possible now to supply a `TaskScheduler` to the manager.
See gh-14353
This commit fixes missing descriptions and default values when
applicable for `management.server.ssl`, `server.compression`,
`server.http2`, `server.servlet.jsp`, `server.servlet.session` and
`server.ssl`.
Those nested namespace are managed by a POJO that is declared outside
of the module of the target @ConfigurationProperties type using it. As
a result, the annotation processor has no access to the source model and
can't extract the description and the default value, if any.
This commit migrates the misleading field-level Javadoc to manual meta
data for the time being.
Closes gh-14669
Generally speaking, methods on configuration classes will only be called once
and, therefore, it should be safe to hold a reference to a Stream for later
one-time usage. However, there are some scenarios in Spring Fu where functional
registration results in an attempt being made to use a Stream more than use.
This commit protects against multiple use by storing the ObjectProvider and
getting a new ordered Stream each time it's needed.
Closes gh-14467
This commit deprecates the few 'enabled' flags that control whether
certain meter binders are registered in the context.
Metrics auto-configuration for the JVM, Logback and System-related
information have been moved to individual auto-configurations so that
they can be excluded rather than using the now deprecated flag.
This harmonizes our policy with regards to disabling behaviour,
especially since other similar auto-configurations do not have such
flag.
Closes gh-13408
This commit harmonizes metrics test to rely on `MetricRun.simple()`
rather than configuring a simple `MeterRegistry` manually. Rather than
applying related auto-configurations automatically, `MetricsRun` only
enable the absolute minimum.
See gh-14255
This commit harmonizes the auto-configurations for RestTemplate and
WebClient in a single `HttpClientMetricsAutoConfiguration`. Doing so
allows to give a better scope for the shared `MeterFilter`.
As a result`WebClientMetricsAutoConfiguration` has moved to the `client`
package.
Closes gh-14269
Upgrade to M2 broke a test that was looking for a particular bean that
is configured by Spring Integration (`HeaderChannelRegistry`).
It looks like INT-4517 is related to the regression as it registers the
bean too late for the auto-configuration to see it.
This commit changes the condition to a more central bean that is created
very early on.
Closes gh-14142
This commit aligns SessionsEndpoint with
FindByIndexNameSessionRepository API improvements that simplifies
retrieval of sessions by principal name.
Closes gh-14124
This commit changes AbstractWebMvcEndpointHandlerMapping to
be a MatchableHandlerMapping. Additionally, EndpointRequest,
now delegates to MvcRequestMatcher for Spring MVC applications.
For all other applications, AntPathRequestMatcher is used as
a delegate.
Closes gh-13962
This commit makes sure to use a configurable timeout to check if the
Couchbase cluster is up, rather than relying on the default that can be
quite long.
Closes gh-13879
This commit ensures that the new "spring.jmx.unique-names" property
deprecates the Endpoint's specific property as they share the same goal.
If both are set with an incompatible value, an exception is thrown
inviting the user to update their configuration.
Closes gh-13990
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