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
This commit is contained in:
Stephane Nicoll 2015-12-10 15:40:44 +01:00
commit 59cb5cf8d9
5 changed files with 10 additions and 3 deletions

View File

@ -45,7 +45,7 @@ import org.springframework.web.servlet.HandlerMapping;
@ConditionalOnClass({ Servlet.class, ServletRegistration.class,
OncePerRequestFilter.class, HandlerMapping.class })
@AutoConfigureAfter(MetricRepositoryAutoConfiguration.class)
@ConditionalOnProperty(name = "endpoints.metrics.enabled", matchIfMissing = true)
@ConditionalOnProperty(name = "endpoints.metrics.filter.enabled", matchIfMissing = true)
public class MetricFilterAutoConfiguration {
@Autowired

View File

@ -33,7 +33,7 @@ import org.springframework.util.Assert;
*
* @author Dave Syer
*/
@ConfigurationProperties(prefix = "endpoints.metrics", ignoreUnknownFields = false)
@ConfigurationProperties(prefix = "endpoints.metrics")
public class MetricsEndpoint extends AbstractEndpoint<Map<String, Object>> {
private final List<PublicMetrics> publicMetrics;

View File

@ -17,6 +17,12 @@
"description": "Enable JMX export of all endpoints.",
"defaultValue": true
},
{
"name": "endpoints.metrics.filter.enabled",
"type": "java.lang.Boolean",
"description": "Enable the metrics servlet filter.",
"defaultValue": true
},
{
"name": "info",
"type": "java.util.Map<java.lang.String,java.lang.Object>",

View File

@ -180,7 +180,7 @@ public class MetricFilterAutoConfigurationTests {
@Test
public void skipsFilterIfPropertyDisabled() throws Exception {
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.refresh();
assertThat(context.getBeansOfType(Filter.class).size(), equalTo(0));

View File

@ -780,6 +780,7 @@ content into your application; rather pick only the properties that you need.
endpoints.mappings.id= # Endpoint identifier.
endpoints.mappings.sensitive= # Mark if the endpoint exposes sensitive information.
endpoints.metrics.enabled= # Enable the endpoint.
endpoints.metrics.filter.enabled=true # Enable the metrics servlet filter.
endpoints.metrics.id= # Endpoint identifier.
endpoints.metrics.sensitive= # Mark if the endpoint exposes sensitive information.
endpoints.shutdown.enabled= # Enable the endpoint.