Commit 59cb5cf8 authored by Stephane Nicoll's avatar Stephane Nicoll

Merge branch '1.2.x'

# Conflicts:
#	spring-boot-actuator/src/main/resources/META-INF/additional-spring-configuration-metadata.json
#	spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc
parents 4f7752d4 ce2346b0
...@@ -45,7 +45,7 @@ import org.springframework.web.servlet.HandlerMapping; ...@@ -45,7 +45,7 @@ import org.springframework.web.servlet.HandlerMapping;
@ConditionalOnClass({ Servlet.class, ServletRegistration.class, @ConditionalOnClass({ Servlet.class, ServletRegistration.class,
OncePerRequestFilter.class, HandlerMapping.class }) OncePerRequestFilter.class, HandlerMapping.class })
@AutoConfigureAfter(MetricRepositoryAutoConfiguration.class) @AutoConfigureAfter(MetricRepositoryAutoConfiguration.class)
@ConditionalOnProperty(name = "endpoints.metrics.enabled", matchIfMissing = true) @ConditionalOnProperty(name = "endpoints.metrics.filter.enabled", matchIfMissing = true)
public class MetricFilterAutoConfiguration { public class MetricFilterAutoConfiguration {
@Autowired @Autowired
......
...@@ -33,7 +33,7 @@ import org.springframework.util.Assert; ...@@ -33,7 +33,7 @@ import org.springframework.util.Assert;
* *
* @author Dave Syer * @author Dave Syer
*/ */
@ConfigurationProperties(prefix = "endpoints.metrics", ignoreUnknownFields = false) @ConfigurationProperties(prefix = "endpoints.metrics")
public class MetricsEndpoint extends AbstractEndpoint<Map<String, Object>> { public class MetricsEndpoint extends AbstractEndpoint<Map<String, Object>> {
private final List<PublicMetrics> publicMetrics; private final List<PublicMetrics> publicMetrics;
......
...@@ -17,6 +17,12 @@ ...@@ -17,6 +17,12 @@
"description": "Enable JMX export of all endpoints.", "description": "Enable JMX export of all endpoints.",
"defaultValue": true "defaultValue": true
}, },
{
"name": "endpoints.metrics.filter.enabled",
"type": "java.lang.Boolean",
"description": "Enable the metrics servlet filter.",
"defaultValue": true
},
{ {
"name": "info", "name": "info",
"type": "java.util.Map<java.lang.String,java.lang.Object>", "type": "java.util.Map<java.lang.String,java.lang.Object>",
......
...@@ -180,7 +180,7 @@ public class MetricFilterAutoConfigurationTests { ...@@ -180,7 +180,7 @@ public class MetricFilterAutoConfigurationTests {
@Test @Test
public void skipsFilterIfPropertyDisabled() throws Exception { public void skipsFilterIfPropertyDisabled() throws Exception {
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
EnvironmentTestUtils.addEnvironment(context, "endpoints.metrics.enabled:false"); EnvironmentTestUtils.addEnvironment(context, "endpoints.metrics.filter.enabled:false");
context.register(Config.class, MetricFilterAutoConfiguration.class); context.register(Config.class, MetricFilterAutoConfiguration.class);
context.refresh(); context.refresh();
assertThat(context.getBeansOfType(Filter.class).size(), equalTo(0)); assertThat(context.getBeansOfType(Filter.class).size(), equalTo(0));
......
...@@ -780,6 +780,7 @@ content into your application; rather pick only the properties that you need. ...@@ -780,6 +780,7 @@ content into your application; rather pick only the properties that you need.
endpoints.mappings.id= # Endpoint identifier. endpoints.mappings.id= # Endpoint identifier.
endpoints.mappings.sensitive= # Mark if the endpoint exposes sensitive information. endpoints.mappings.sensitive= # Mark if the endpoint exposes sensitive information.
endpoints.metrics.enabled= # Enable the endpoint. endpoints.metrics.enabled= # Enable the endpoint.
endpoints.metrics.filter.enabled=true # Enable the metrics servlet filter.
endpoints.metrics.id= # Endpoint identifier. endpoints.metrics.id= # Endpoint identifier.
endpoints.metrics.sensitive= # Mark if the endpoint exposes sensitive information. endpoints.metrics.sensitive= # Mark if the endpoint exposes sensitive information.
endpoints.shutdown.enabled= # Enable the endpoint. endpoints.shutdown.enabled= # Enable the endpoint.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment