-
Notifications
You must be signed in to change notification settings - Fork 40.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make endpoint web extensions conditional on endpoint being exposed over HTTP #28389
Comments
Hi, I'd like to claim this issue |
Thanks very much, @davidh44. It's all yours. Please let us know if you have any questions. |
@davidh44 are you working on this issue ? |
@shikha-varun yup spending time this weekend on it |
@wilkinsona @mbhave I dug into the documentation + codebase and last commit (b7521e2), and have a few questions to clarify my understanding:
Thanks |
Not quite.
The changes only apply to the
For each of the four auto-configurations, I'd add a new test that enables JMX ( @Test
void runWhenOnlyExposedOverJmxShouldHaveEndpointBeanWithoutWebExtension() {
this.contextRunner.withBean(CacheManager.class, () -> mock(CacheManager.class))
.withInitializer(new ConditionEvaluationReportLoggingListener(LogLevel.DEBUG))
.withPropertyValues("spring.jmx.enabled=true", "management.endpoints.jmx.exposure.include=caches")
.run((context) -> assertThat(context).hasSingleBean(CachesEndpoint.class)
.doesNotHaveBean(CachesEndpointWebExtension.class));
}
No, I don't think so, but feel free to let us know if you have any further questions. |
@wilkinsona Thanks, makes sense! I made some changes and started a pull request. Let me know how it looks, thanks. |
Great stuff. Thanks, @davidh44. I'll close this issue in favor of your PR. |
Hi, this is a
first-timers-only
issue. This means we've worked to make it more legible to folks who either haven't contributed to our codebase before, or even folks who haven't contributed to open source before.If that's you, we're interested in helping you take the first step and can answer questions and help you out as you do. Note that we're especially interested in contributions from people from groups underrepresented in free and open source software!
If you have contributed before, consider leaving this one for someone new, and looking through our general
ideal-for-contribution
issues. Thanks!Problem
Spring Boot provides a number of built-in endpoints, called actuators, to help you monitor and and manage your application. These endpoints are available over JMX and HTTP. However, depending on the technology, the behavior of some of these endpoints might need to change. For example, when the health endpoint is used over HTTP and the endpoint returns a status of
down
, this gets mapped to the503
status code. For this purpose, these endpoints have technology specific extensions which are annotated with@EndpointWebExtension
or@EndpointJmxExtension
. The beans for these extensions should be auto-configured only if the endpoint is exposed over that technology. Otherwise, it's an unnecessary additional bean in the application context. Currently, whenspring.jmx.enabled=true
, even if the endpoint is not exposed over HTTP, the bean for the web extensions will be created.Solution
#28131 added support for an additional attribute on
@ConditionalOnAvailableEndpoint
. We can update auto-configurations for web extensions to make use of it.CachesEndpointWebExtension
EnvironmentEndpointWebExtension
QuartzEndpointWebExtension
ConfigurationPropertiesReportEndpointWebExtension
Tests for the corresponding auto-configurations will also need to be added to make sure that creation of the bean backs off correctly.
Steps to Fix
The text was updated successfully, but these errors were encountered: