Harmonize endpoints exclude property
Closes gh-11914
This commit is contained in:
@@ -44,7 +44,7 @@ public class ExposeExcludePropertyEndpointFilter<E extends ExposableEndpoint<?>>
|
||||
|
||||
private final Class<E> endpointType;
|
||||
|
||||
private final Set<String> expose;
|
||||
private final Set<String> include;
|
||||
|
||||
private final Set<String> exclude;
|
||||
|
||||
@@ -57,17 +57,17 @@ public class ExposeExcludePropertyEndpointFilter<E extends ExposableEndpoint<?>>
|
||||
Assert.hasText(prefix, "Prefix must not be empty");
|
||||
Binder binder = Binder.get(environment);
|
||||
this.endpointType = endpointType;
|
||||
this.expose = bind(binder, prefix + ".expose");
|
||||
this.include = bind(binder, prefix + ".expose");
|
||||
this.exclude = bind(binder, prefix + ".exclude");
|
||||
this.exposeDefaults = asSet(Arrays.asList(exposeDefaults));
|
||||
}
|
||||
|
||||
public ExposeExcludePropertyEndpointFilter(Class<E> endpointType,
|
||||
Collection<String> expose, Collection<String> exclude,
|
||||
Collection<String> include, Collection<String> exclude,
|
||||
String... exposeDefaults) {
|
||||
Assert.notNull(endpointType, "EndpointType Type must not be null");
|
||||
this.endpointType = endpointType;
|
||||
this.expose = asSet(expose);
|
||||
this.include = asSet(include);
|
||||
this.exclude = asSet(exclude);
|
||||
this.exposeDefaults = asSet(Arrays.asList(exposeDefaults));
|
||||
}
|
||||
@@ -94,11 +94,11 @@ public class ExposeExcludePropertyEndpointFilter<E extends ExposableEndpoint<?>>
|
||||
}
|
||||
|
||||
private boolean isExposed(ExposableEndpoint<?> endpoint) {
|
||||
if (this.expose.isEmpty()) {
|
||||
if (this.include.isEmpty()) {
|
||||
return this.exposeDefaults.contains("*")
|
||||
|| contains(this.exposeDefaults, endpoint);
|
||||
}
|
||||
return this.expose.contains("*") || contains(this.expose, endpoint);
|
||||
return this.include.contains("*") || contains(this.include, endpoint);
|
||||
}
|
||||
|
||||
private boolean isExcluded(ExposableEndpoint<?> endpoint) {
|
||||
|
||||
@@ -18,7 +18,6 @@ package org.springframework.boot.actuate.autoconfigure.endpoint.jmx;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.management.MBeanServer;
|
||||
|
||||
@@ -97,10 +96,9 @@ public class JmxEndpointAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public ExposeExcludePropertyEndpointFilter<ExposableJmxEndpoint> jmxIncludeExcludePropertyEndpointFilter() {
|
||||
Set<String> expose = this.properties.getExpose();
|
||||
Set<String> exclude = this.properties.getExclude();
|
||||
JmxEndpointProperties.Exposure exposure = this.properties.getExposure();
|
||||
return new ExposeExcludePropertyEndpointFilter<>(ExposableJmxEndpoint.class,
|
||||
expose, exclude, "*");
|
||||
exposure.getInclude(), exposure.getExclude(), "*");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -33,15 +33,7 @@ import org.springframework.util.StringUtils;
|
||||
@ConfigurationProperties("management.endpoints.jmx")
|
||||
public class JmxEndpointProperties {
|
||||
|
||||
/**
|
||||
* Endpoint IDs that should be exposed or '*' for all.
|
||||
*/
|
||||
private Set<String> expose = new LinkedHashSet<>();
|
||||
|
||||
/**
|
||||
* Endpoint IDs that should be excluded.
|
||||
*/
|
||||
private Set<String> exclude = new LinkedHashSet<>();
|
||||
private final Exposure exposure = new Exposure();
|
||||
|
||||
/**
|
||||
* Endpoints JMX domain name. Fallback to 'spring.jmx.default-domain' if set.
|
||||
@@ -66,20 +58,8 @@ public class JmxEndpointProperties {
|
||||
}
|
||||
}
|
||||
|
||||
public Set<String> getExpose() {
|
||||
return this.expose;
|
||||
}
|
||||
|
||||
public void setExpose(Set<String> expose) {
|
||||
this.expose = expose;
|
||||
}
|
||||
|
||||
public Set<String> getExclude() {
|
||||
return this.exclude;
|
||||
}
|
||||
|
||||
public void setExclude(Set<String> exclude) {
|
||||
this.exclude = exclude;
|
||||
public Exposure getExposure() {
|
||||
return this.exposure;
|
||||
}
|
||||
|
||||
public String getDomain() {
|
||||
@@ -102,4 +82,35 @@ public class JmxEndpointProperties {
|
||||
return this.staticNames;
|
||||
}
|
||||
|
||||
|
||||
public static class Exposure {
|
||||
|
||||
/**
|
||||
* Endpoint IDs that should be included or '*' for all.
|
||||
*/
|
||||
private Set<String> include = new LinkedHashSet<>();
|
||||
|
||||
/**
|
||||
* Endpoint IDs that should be excluded.
|
||||
*/
|
||||
private Set<String> exclude = new LinkedHashSet<>();
|
||||
|
||||
public Set<String> getInclude() {
|
||||
return this.include;
|
||||
}
|
||||
|
||||
public void setInclude(Set<String> include) {
|
||||
this.include = include;
|
||||
}
|
||||
|
||||
public Set<String> getExclude() {
|
||||
return this.exclude;
|
||||
}
|
||||
|
||||
public void setExclude(Set<String> exclude) {
|
||||
this.exclude = exclude;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -16,8 +16,6 @@
|
||||
|
||||
package org.springframework.boot.actuate.autoconfigure.endpoint.web;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.ExposeExcludePropertyEndpointFilter;
|
||||
import org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration;
|
||||
import org.springframework.boot.actuate.endpoint.web.ExposableServletEndpoint;
|
||||
@@ -51,10 +49,9 @@ public class ServletEndpointManagementContextConfiguration {
|
||||
@Bean
|
||||
public ExposeExcludePropertyEndpointFilter<ExposableServletEndpoint> servletExposeExcludePropertyEndpointFilter(
|
||||
WebEndpointProperties properties) {
|
||||
Set<String> expose = properties.getExpose();
|
||||
Set<String> exclude = properties.getExclude();
|
||||
WebEndpointProperties.Exposure exposure = properties.getExposure();
|
||||
return new ExposeExcludePropertyEndpointFilter<>(ExposableServletEndpoint.class,
|
||||
expose, exclude);
|
||||
exposure.getInclude(), exposure.getExclude());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.springframework.beans.factory.ObjectProvider;
|
||||
import org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration;
|
||||
@@ -125,18 +124,17 @@ public class WebEndpointAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public ExposeExcludePropertyEndpointFilter<ExposableWebEndpoint> webExposeExcludePropertyEndpointFilter() {
|
||||
Set<String> expose = this.properties.getExpose();
|
||||
Set<String> exclude = this.properties.getExclude();
|
||||
WebEndpointProperties.Exposure exposure = this.properties.getExposure();
|
||||
return new ExposeExcludePropertyEndpointFilter<>(ExposableWebEndpoint.class,
|
||||
expose, exclude, "info", "health");
|
||||
exposure.getInclude(), exposure.getExclude(), "info", "health");
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ExposeExcludePropertyEndpointFilter<ExposableControllerEndpoint> controllerExposeExcludePropertyEndpointFilter() {
|
||||
Set<String> expose = this.properties.getExpose();
|
||||
Set<String> exclude = this.properties.getExclude();
|
||||
WebEndpointProperties.Exposure exposure = this.properties.getExposure();
|
||||
return new ExposeExcludePropertyEndpointFilter<>(
|
||||
ExposableControllerEndpoint.class, expose, exclude);
|
||||
ExposableControllerEndpoint.class, exposure.getInclude(),
|
||||
exposure.getExclude());
|
||||
}
|
||||
|
||||
@Configuration
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2018 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -34,27 +34,23 @@ import org.springframework.util.StringUtils;
|
||||
@ConfigurationProperties(prefix = "management.endpoints.web")
|
||||
public class WebEndpointProperties {
|
||||
|
||||
private final Exposure exposure = new Exposure();
|
||||
|
||||
/**
|
||||
* Base path for Web endpoints. Relative to server.servlet.context-path or
|
||||
* management.server.servlet.context-path if management.server.port is configured.
|
||||
*/
|
||||
private String basePath = "/actuator";
|
||||
|
||||
/**
|
||||
* Endpoint IDs that should be exposed or '*' for all.
|
||||
*/
|
||||
private Set<String> expose = new LinkedHashSet<>();
|
||||
|
||||
/**
|
||||
* Endpoint IDs that should be excluded.
|
||||
*/
|
||||
private Set<String> exclude = new LinkedHashSet<>();
|
||||
|
||||
/**
|
||||
* Mapping between endpoint IDs and the path that should expose them.
|
||||
*/
|
||||
private final Map<String, String> pathMapping = new LinkedHashMap<>();
|
||||
|
||||
public Exposure getExposure() {
|
||||
return this.exposure;
|
||||
}
|
||||
|
||||
public String getBasePath() {
|
||||
return this.basePath;
|
||||
}
|
||||
@@ -70,24 +66,39 @@ public class WebEndpointProperties {
|
||||
return basePath;
|
||||
}
|
||||
|
||||
public Set<String> getExpose() {
|
||||
return this.expose;
|
||||
}
|
||||
|
||||
public void setExpose(Set<String> expose) {
|
||||
this.expose = expose;
|
||||
}
|
||||
|
||||
public Set<String> getExclude() {
|
||||
return this.exclude;
|
||||
}
|
||||
|
||||
public void setExclude(Set<String> exclude) {
|
||||
this.exclude = exclude;
|
||||
}
|
||||
|
||||
public Map<String, String> getPathMapping() {
|
||||
return this.pathMapping;
|
||||
}
|
||||
|
||||
|
||||
public static class Exposure {
|
||||
|
||||
/**
|
||||
* Endpoint IDs that should be included or '*' for all.
|
||||
*/
|
||||
private Set<String> include = new LinkedHashSet<>();
|
||||
|
||||
/**
|
||||
* Endpoint IDs that should be excluded.
|
||||
*/
|
||||
private Set<String> exclude = new LinkedHashSet<>();
|
||||
|
||||
public Set<String> getInclude() {
|
||||
return this.include;
|
||||
}
|
||||
|
||||
public void setInclude(Set<String> include) {
|
||||
this.include = include;
|
||||
}
|
||||
|
||||
public Set<String> getExclude() {
|
||||
return this.exclude;
|
||||
}
|
||||
|
||||
public void setExclude(Set<String> exclude) {
|
||||
this.exclude = exclude;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -28,11 +28,11 @@
|
||||
"description": "Whether to enable or disable all endpoints by default."
|
||||
},
|
||||
{
|
||||
"name": "management.endpoints.jmx.expose",
|
||||
"name": "management.endpoints.jmx.exposure.include",
|
||||
"defaultValue": "*"
|
||||
},
|
||||
{
|
||||
"name": "management.endpoints.web.expose",
|
||||
"name": "management.endpoints.web.exposure.include",
|
||||
"defaultValue": [
|
||||
"health",
|
||||
"info"
|
||||
@@ -755,7 +755,7 @@
|
||||
"description": "Whether to enable JMX export of all endpoints.",
|
||||
"defaultValue": true,
|
||||
"deprecation": {
|
||||
"replacement": "management.endpoints.jmx.exclude",
|
||||
"replacement": "management.endpoints.jmx.exposure.exclude",
|
||||
"level": "error"
|
||||
}
|
||||
},
|
||||
|
||||
@@ -56,7 +56,7 @@ import static org.springframework.restdocs.payload.PayloadDocumentation.fieldWit
|
||||
* @author Andy Wilkinson
|
||||
*/
|
||||
@TestPropertySource(properties = { "spring.jackson.serialization.indent_output=true",
|
||||
"management.endpoints.web.expose=*",
|
||||
"management.endpoints.web.exposure.include=*",
|
||||
"spring.jackson.default-property-inclusion=non_null" })
|
||||
public class AbstractEndpointDocumentationTests {
|
||||
|
||||
|
||||
@@ -61,7 +61,8 @@ public class ControllerEndpointWebFluxIntegrationTests {
|
||||
new TestingAuthenticationToken("user", "N/A", "ROLE_ACTUATOR"));
|
||||
this.context = new AnnotationConfigReactiveWebApplicationContext();
|
||||
this.context.register(DefaultConfiguration.class, ExampleController.class);
|
||||
TestPropertyValues.of("management.endpoints.web.expose=*").applyTo(this.context);
|
||||
TestPropertyValues.of("management.endpoints.web.exposure.include=*").applyTo(
|
||||
this.context);
|
||||
this.context.refresh();
|
||||
WebTestClient webClient = WebTestClient.bindToApplicationContext(this.context)
|
||||
.build();
|
||||
|
||||
@@ -84,7 +84,7 @@ public class ControllerEndpointWebMvcIntegrationTests {
|
||||
this.context = new AnnotationConfigWebApplicationContext();
|
||||
this.context.register(SecureConfiguration.class, ExampleController.class);
|
||||
TestPropertyValues.of("management.endpoints.web.base-path:/management",
|
||||
"management.endpoints.web.expose=*").applyTo(this.context);
|
||||
"management.endpoints.web.exposure.include=*").applyTo(this.context);
|
||||
MockMvc mockMvc = createSecureMockMvc();
|
||||
mockMvc.perform(get("/management/example")).andExpect(status().isOk());
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ public class JerseyEndpointIntegrationTests {
|
||||
ManagementContextAutoConfiguration.class,
|
||||
BeansEndpointAutoConfiguration.class))
|
||||
.withUserConfiguration(EndpointsConfiguration.class)
|
||||
.withPropertyValues("management.endpoints.web.expose:*",
|
||||
.withPropertyValues("management.endpoints.web.exposure.include:*",
|
||||
"server.port:0")
|
||||
.run((context) -> {
|
||||
int port = context.getSourceApplicationContext(
|
||||
|
||||
@@ -64,7 +64,8 @@ public class JmxEndpointIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void jmxEndpointsCanBeExcluded() {
|
||||
this.contextRunner.withPropertyValues("management.endpoints.jmx.exclude:*")
|
||||
this.contextRunner
|
||||
.withPropertyValues("management.endpoints.jmx.exposure.exclude:*")
|
||||
.run((context) -> {
|
||||
MBeanServer mBeanServer = context.getBean(MBeanServer.class);
|
||||
checkEndpointMBeans(mBeanServer, new String[0],
|
||||
@@ -77,7 +78,8 @@ public class JmxEndpointIntegrationTests {
|
||||
|
||||
@Test
|
||||
public void singleJmxEndpointCanBeExposed() {
|
||||
this.contextRunner.withPropertyValues("management.endpoints.jmx.expose=beans")
|
||||
this.contextRunner
|
||||
.withPropertyValues("management.endpoints.jmx.exposure.include=beans")
|
||||
.run((context) -> {
|
||||
MBeanServer mBeanServer = context.getBean(MBeanServer.class);
|
||||
checkEndpointMBeans(mBeanServer, new String[] { "beans" },
|
||||
|
||||
@@ -61,7 +61,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest(webEnvironment = WebEnvironment.RANDOM_PORT)
|
||||
@DirtiesContext
|
||||
@TestPropertySource(properties = "management.endpoints.web.expose=jolokia")
|
||||
@TestPropertySource(properties = "management.endpoints.web.exposure.include=jolokia")
|
||||
public class JolokiaEndpointAutoConfigurationIntegrationTests {
|
||||
|
||||
@Autowired
|
||||
|
||||
@@ -54,7 +54,8 @@ public class WebFluxEndpointCorsIntegrationTests {
|
||||
ManagementContextAutoConfiguration.class,
|
||||
ReactiveManagementContextAutoConfiguration.class,
|
||||
BeansEndpointAutoConfiguration.class);
|
||||
TestPropertyValues.of("management.endpoints.web.expose:*").applyTo(this.context);
|
||||
TestPropertyValues.of("management.endpoints.web.exposure.include:*").applyTo(
|
||||
this.context);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -55,7 +55,7 @@ public class WebFluxEndpointIntegrationTests {
|
||||
ReactiveManagementContextAutoConfiguration.class,
|
||||
BeansEndpointAutoConfiguration.class))
|
||||
.withUserConfiguration(EndpointsConfiguration.class)
|
||||
.withPropertyValues("management.endpoints.web.expose:*")
|
||||
.withPropertyValues("management.endpoints.web.exposure.include:*")
|
||||
.run((context) -> {
|
||||
WebTestClient client = createWebTestClient(context);
|
||||
client.get().uri("/actuator").exchange().expectStatus().isOk()
|
||||
|
||||
@@ -62,7 +62,8 @@ public class WebMvcEndpointCorsIntegrationTests {
|
||||
ManagementContextAutoConfiguration.class,
|
||||
ServletManagementContextAutoConfiguration.class,
|
||||
BeansEndpointAutoConfiguration.class);
|
||||
TestPropertyValues.of("management.endpoints.web.expose:*").applyTo(this.context);
|
||||
TestPropertyValues.of("management.endpoints.web.exposure.include:*").applyTo(
|
||||
this.context);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -102,7 +102,7 @@ public class WebMvcEndpointExposureIntegrationTests {
|
||||
@Test
|
||||
public void webEndpointsCanBeExposed() {
|
||||
WebApplicationContextRunner contextRunner = this.contextRunner
|
||||
.withPropertyValues("management.endpoints.web.expose=*");
|
||||
.withPropertyValues("management.endpoints.web.exposure.include=*");
|
||||
contextRunner.run((context) -> {
|
||||
WebTestClient client = createClient(context);
|
||||
assertThat(isExposed(client, HttpMethod.GET, "beans")).isTrue();
|
||||
@@ -123,7 +123,7 @@ public class WebMvcEndpointExposureIntegrationTests {
|
||||
@Test
|
||||
public void singleWebEndpointCanBeExposed() {
|
||||
WebApplicationContextRunner contextRunner = this.contextRunner
|
||||
.withPropertyValues("management.endpoints.web.expose=beans");
|
||||
.withPropertyValues("management.endpoints.web.exposure.include=beans");
|
||||
contextRunner.run((context) -> {
|
||||
WebTestClient client = createClient(context);
|
||||
assertThat(isExposed(client, HttpMethod.GET, "beans")).isTrue();
|
||||
@@ -144,8 +144,8 @@ public class WebMvcEndpointExposureIntegrationTests {
|
||||
@Test
|
||||
public void singleWebEndpointCanBeExcluded() {
|
||||
WebApplicationContextRunner contextRunner = this.contextRunner.withPropertyValues(
|
||||
"management.endpoints.web.expose=*",
|
||||
"management.endpoints.web.exclude=shutdown");
|
||||
"management.endpoints.web.exposure.include=*",
|
||||
"management.endpoints.web.exposure.exclude=shutdown");
|
||||
contextRunner.run((context) -> {
|
||||
WebTestClient client = createClient(context);
|
||||
assertThat(isExposed(client, HttpMethod.GET, "beans")).isTrue();
|
||||
|
||||
@@ -105,7 +105,7 @@ public class WebMvcEndpointIntegrationTests {
|
||||
this.context = new AnnotationConfigWebApplicationContext();
|
||||
this.context.register(SecureConfiguration.class);
|
||||
TestPropertyValues.of("management.endpoints.web.base-path:/management",
|
||||
"management.endpoints.web.expose=*").applyTo(this.context);
|
||||
"management.endpoints.web.exposure.include=*").applyTo(this.context);
|
||||
MockMvc mockMvc = createSecureMockMvc();
|
||||
mockMvc.perform(get("/management/beans")).andExpect(status().isOk());
|
||||
}
|
||||
@@ -114,7 +114,8 @@ public class WebMvcEndpointIntegrationTests {
|
||||
public void linksAreProvidedToAllEndpointTypes() throws Exception {
|
||||
this.context = new AnnotationConfigWebApplicationContext();
|
||||
this.context.register(DefaultConfiguration.class, EndpointsConfiguration.class);
|
||||
TestPropertyValues.of("management.endpoints.web.expose=*").applyTo(this.context);
|
||||
TestPropertyValues.of("management.endpoints.web.exposure.include=*").applyTo(
|
||||
this.context);
|
||||
MockMvc mockMvc = doCreateMockMvc();
|
||||
mockMvc.perform(get("/actuator").accept("*/*")).andExpect(status().isOk())
|
||||
.andExpect(jsonPath("_links", both(hasKey("beans")).and(hasKey("servlet"))
|
||||
|
||||
@@ -31,7 +31,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
public class HeapDumpWebEndpointAutoConfigurationTests {
|
||||
|
||||
private final WebApplicationContextRunner contextRunner = new WebApplicationContextRunner()
|
||||
.withPropertyValues("management.endpoints.web.expose:*")
|
||||
.withPropertyValues("management.endpoints.web.exposure.include:*")
|
||||
.withUserConfiguration(HeapDumpWebEndpointAutoConfiguration.class);
|
||||
|
||||
@Test
|
||||
|
||||
@@ -42,7 +42,8 @@ import org.springframework.test.web.reactive.server.WebTestClient;
|
||||
* {@link org.springframework.core.env.Environment} are reset at the end of every test.
|
||||
* This means that {@link TestPropertyValues} can be used in a test without affecting the
|
||||
* {@code Environment} of other tests in the same class. The runner always sets the flag
|
||||
* {@code management.endpoints.web.expose} to {@code *} so that web endpoints are enabled.
|
||||
* {@code management.endpoints.web.exposure.include} to {@code *} so that web endpoints
|
||||
* are enabled.
|
||||
*
|
||||
* @author Andy Wilkinson
|
||||
* @author Phillip Webb
|
||||
|
||||
@@ -1151,15 +1151,15 @@ content into your application. Rather, pick only the properties that you need.
|
||||
management.endpoints.enabled-by-default= # Enable or disable all endpoints by default.
|
||||
|
||||
# ENDPOINTS JMX CONFIGURATION ({sc-spring-boot-actuator-autoconfigure}/endpoint/jmx/JmxEndpointProperties.{sc-ext}[JmxEndpointProperties])
|
||||
management.endpoints.jmx.expose=* # Endpoint IDs that should be exposed or '*' for all.
|
||||
management.endpoints.jmx.exclude= # Endpoint IDs that should be excluded.
|
||||
management.endpoints.jmx.domain=org.springframework.boot # Endpoints JMX domain name. Fallback to 'spring.jmx.default-domain' if set.
|
||||
management.endpoints.jmx.exposure.include=* # Endpoint IDs that should be included or '*' for all.
|
||||
management.endpoints.jmx.exposure.exclude= # Endpoint IDs that should be excluded.
|
||||
management.endpoints.jmx.static-names=false # Additional static properties to append to all ObjectNames of MBeans representing Endpoints.
|
||||
management.endpoints.jmx.unique-names=false # Whether to ensure that ObjectNames are modified in case of conflict.
|
||||
|
||||
# ENDPOINTS WEB CONFIGURATION ({sc-spring-boot-actuator-autoconfigure}/endpoint/web/WebEndpointProperties.{sc-ext}[WebEndpointProperties])
|
||||
management.endpoints.web.expose=info,health # Endpoint IDs that should be exposed or '*' for all.
|
||||
management.endpoints.web.exclude= # Endpoint IDs that should be excluded.
|
||||
management.endpoints.web.exposure.include=info,health # Endpoint IDs that should be included or '*' for all.
|
||||
management.endpoints.web.exposure.exclude= # Endpoint IDs that should be excluded.
|
||||
management.endpoints.web.base-path=/actuator # Base path for Web endpoints. Relative to server.servlet.context-path or management.server.servlet.context-path if management.server.port is configured.
|
||||
management.endpoints.web.path-mapping= # Mapping between endpoint IDs and the path that should expose them.
|
||||
|
||||
|
||||
@@ -197,7 +197,7 @@ disables all other endpoints:
|
||||
|
||||
NOTE: Disabled endpoints are removed entirely from the application context. If you want
|
||||
to change only the technologies over which an endpoint is exposed, use the
|
||||
<<production-ready-endpoints-exposing-endpoints, `expose` and `exclude` properties>>
|
||||
<<production-ready-endpoints-exposing-endpoints, `include` and `exclude` properties>>
|
||||
instead.
|
||||
|
||||
|
||||
@@ -298,38 +298,38 @@ endpoints:
|
||||
|
||||
|===
|
||||
|
||||
To change which endpoints are exposed, use the following technology-specific `expose` and
|
||||
To change which endpoints are exposed, use the following technology-specific `include` and
|
||||
`exclude` properties:
|
||||
|
||||
[cols="3,1"]
|
||||
|===
|
||||
|Property | Default
|
||||
|
||||
|`management.endpoints.jmx.exclude`
|
||||
|`management.endpoints.jmx.exposure.exclude`
|
||||
|
|
||||
|
||||
|`management.endpoints.jmx.expose`
|
||||
|`management.endpoints.jmx.exposure.include`
|
||||
| `*`
|
||||
|
||||
|`management.endpoints.web.exclude`
|
||||
|`management.endpoints.web.exposure.exclude`
|
||||
|
|
||||
|
||||
|`management.endpoints.web.expose`
|
||||
|`management.endpoints.web.exposure.include`
|
||||
| `info, health`
|
||||
|
||||
|===
|
||||
|
||||
The `expose` property lists the IDs of the endpoints that are exposed. The `exclude`
|
||||
The `include` property lists the IDs of the endpoints that are exposed. The `exclude`
|
||||
property lists the IDs of the endpoints that should not be exposed. The `exclude`
|
||||
property takes precedence over the `expose` property. Both `expose` and `exclude` properties
|
||||
can be configured with a list of endpoint IDs.
|
||||
property takes precedence over the `include` property. Both `include` and `exclude`
|
||||
properties can be configured with a list of endpoint IDs.
|
||||
|
||||
For example, to stop exposing all endpoints over JMX and only expose the `health` and `info`
|
||||
endpoints, use the following property:
|
||||
For example, to stop exposing all endpoints over JMX and only expose the `health` and
|
||||
`info` endpoints, use the following property:
|
||||
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
management.endpoints.jmx.expose=health,info
|
||||
management.endpoints.jmx.exposure.include=health,info
|
||||
----
|
||||
|
||||
`*` can be used to select all endpoints. For example, to expose everything over HTTP
|
||||
@@ -337,8 +337,8 @@ except the `env` and `beans` endpoints, use the following properties:
|
||||
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
management.endpoints.web.expose=*
|
||||
management.endpoints.web.exclude=env,beans
|
||||
management.endpoints.web.exposure.include=*
|
||||
management.endpoints.web.exposure.exclude=env,beans
|
||||
----
|
||||
|
||||
NOTE: If your application is exposed publicly, we strongly recommend that you also
|
||||
@@ -384,12 +384,12 @@ methods are also available on `EndpointRequest`. See the API documentation
|
||||
|
||||
If you deploy applications behind a firewall, you may prefer that all your actuator
|
||||
endpoints can be accessed without requiring authentication. You can do so by changing the
|
||||
`management.endpoints.web.expose` property, as follows:
|
||||
`management.endpoints.web.exposure.include` property, as follows:
|
||||
|
||||
.application.properties
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
management.endpoints.web.expose=*
|
||||
management.endpoints.web.exposure.include=*
|
||||
----
|
||||
|
||||
Additionally, if Spring Security is present, you would need to add custom security
|
||||
@@ -1014,11 +1014,12 @@ settings show an example of doing so in `application.properties`:
|
||||
[[production-ready-disable-jmx-endpoints]]
|
||||
=== Disabling JMX Endpoints
|
||||
If you do not want to expose endpoints over JMX, you can set the
|
||||
`management.endpoints.jmx.exclude` property to `*`, as shown in the following example:
|
||||
`management.endpoints.jmx.exposure.exclude` property to `*`, as shown in the following
|
||||
example:
|
||||
|
||||
[source,properties,indent=0]
|
||||
----
|
||||
management.endpoints.jmx.exclude=*
|
||||
management.endpoints.jmx.exposure.exclude=*
|
||||
----
|
||||
|
||||
|
||||
@@ -1038,7 +1039,7 @@ Maven, you would add the following dependency:
|
||||
----
|
||||
|
||||
The Jolokia endpoint can then be exposed by adding `jolokia` or `*` to the
|
||||
`management.endpoints.web.expose` property. You can then access it by using
|
||||
`management.endpoints.web.exposure.include` property. You can then access it by using
|
||||
`/actuator/jolokia` on your management HTTP server.
|
||||
|
||||
|
||||
|
||||
@@ -3131,15 +3131,18 @@ In other words, the two configurations in the following example use the Google p
|
||||
|
||||
[[boot-features-security-actuator]]
|
||||
=== Actuator Security
|
||||
For security purposes, all actuators other than `/health` and `/info` are disabled by default.
|
||||
The `management.endpoints.web.expose` flag can be used to enable the actuators.
|
||||
If Spring Security is on the classpath and no other WebSecurityConfigurerAdapter is present,
|
||||
the actuators are secured by Spring Boot auto-config. If you define a custom `WebSecurityConfigurerAdapter`,
|
||||
Spring Boot auto-config will back off and you will be in full control of actuator access rules.
|
||||
For security purposes, all actuators other than `/health` and `/info` are disabled by
|
||||
default. The `management.endpoints.web.exposure.include` property can be used to enable
|
||||
the actuators.
|
||||
|
||||
NOTE: Before setting the `management.endpoints.web.expose`, ensure that the exposed actuators
|
||||
do not contain sensitive information and/or are secured by placing them behind a firewall or by
|
||||
something like Spring Security.
|
||||
If Spring Security is on the classpath and no other WebSecurityConfigurerAdapter is
|
||||
present, the actuators are secured by Spring Boot auto-config. If you define a custom
|
||||
`WebSecurityConfigurerAdapter`, Spring Boot auto-config will back off and you will be in
|
||||
full control of actuator access rules.
|
||||
|
||||
NOTE: Before setting the `management.endpoints.web.exposure.include`, ensure that the
|
||||
exposed actuators do not contain sensitive information and/or are secured by placing them
|
||||
behind a firewall or by something like Spring Security.
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
management.endpoints.web.expose=*
|
||||
management.endpoints.web.exposure.include=*
|
||||
management.endpoint.health.show-details=always
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
spring.security.user.name=user
|
||||
spring.security.user.password=password
|
||||
management.endpoint.shutdown.enabled=true
|
||||
management.endpoints.web.expose=*
|
||||
management.endpoints.web.exposure.include=*
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
spring.security.user.name=user
|
||||
spring.security.user.password=password
|
||||
management.health.diskspace.enabled=false
|
||||
management.endpoints.web.expose=*
|
||||
management.endpoints.web.exposure.include=*
|
||||
|
||||
@@ -7,7 +7,7 @@ spring.security.user.password=password
|
||||
# logging.level.org.springframework.security=DEBUG
|
||||
management.server.address=127.0.0.1
|
||||
|
||||
management.endpoints.web.expose=*
|
||||
management.endpoints.web.exposure.include=*
|
||||
management.endpoint.shutdown.enabled=true
|
||||
|
||||
server.tomcat.basedir=target/tomcat
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
management.endpoints.web.expose=*
|
||||
management.endpoints.web.exposure.include=*
|
||||
|
||||
#
|
||||
# Infinispan configuration file location.
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
management.endpoints.web.expose=*
|
||||
management.endpoints.web.exposure.include=*
|
||||
spring.jpa.hibernate.ddl-auto=validate
|
||||
spring.jpa.open-in-view=true
|
||||
spring.h2.console.enabled=true
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
management.endpoints.web.expose=*
|
||||
management.endpoints.web.exposure.include=*
|
||||
|
||||
spring.h2.console.enabled=true
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
spring.security.user.name=user
|
||||
spring.security.user.password=password
|
||||
management.endpoints.web.expose=*
|
||||
management.endpoints.web.exposure.include=*
|
||||
@@ -1,3 +1,3 @@
|
||||
spring.security.user.name=user
|
||||
spring.security.user.password=password
|
||||
management.endpoints.web.expose=*
|
||||
management.endpoints.web.exposure.include=*
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
spring.thymeleaf.cache: false
|
||||
logging.level.org.springframework.security: INFO
|
||||
management.endpoints.web.expose=*
|
||||
management.endpoints.web.exposure.include=*
|
||||
|
||||
Reference in New Issue
Block a user