parent
f9b51cc870
commit
3b5ecbd066
|
@ -24,7 +24,7 @@ import org.springframework.core.annotation.AnnotationAttributes;
|
||||||
import org.springframework.core.type.AnnotatedTypeMetadata;
|
import org.springframework.core.type.AnnotatedTypeMetadata;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base endpoint element condition. An element can be disabled globally via the `defaults`
|
* Base endpoint element condition. An element can be disabled globally via the {@code defaults}
|
||||||
* name or individually via the name of the element.
|
* name or individually via the name of the element.
|
||||||
*
|
*
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
|
|
|
@ -19,7 +19,7 @@ package org.springframework.boot.actuate.autoconfigure;
|
||||||
import org.springframework.context.annotation.Condition;
|
import org.springframework.context.annotation.Condition;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* {@link Condition} that checks if a info indicator is enabled.
|
* {@link Condition} that checks if an info indicator is enabled.
|
||||||
*
|
*
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright 2012-2015 the original author or authors.
|
* Copyright 2012-2016 the original author or authors.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
|
@ -219,15 +219,15 @@ public final class Health {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Record detail using {@code key} and {@code value}.
|
* Record detail using given {@code key} and {@code value}.
|
||||||
* @param key the detail key
|
* @param key the detail key
|
||||||
* @param data the detail data
|
* @param value the detail value
|
||||||
* @return this {@link Builder} instance
|
* @return this {@link Builder} instance
|
||||||
*/
|
*/
|
||||||
public Builder withDetail(String key, Object data) {
|
public Builder withDetail(String key, Object value) {
|
||||||
Assert.notNull(key, "Key must not be null");
|
Assert.notNull(key, "Key must not be null");
|
||||||
Assert.notNull(data, "Data must not be null");
|
Assert.notNull(value, "Value must not be null");
|
||||||
this.details.put(key, data);
|
this.details.put(key, value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,7 +26,7 @@ import com.fasterxml.jackson.annotation.JsonInclude.Include;
|
||||||
/**
|
/**
|
||||||
* Carries information of the application.
|
* Carries information of the application.
|
||||||
* <p>
|
* <p>
|
||||||
* Each detail element can be singular or a hierarchical object such as a pojo or a nested
|
* Each detail element can be singular or a hierarchical object such as a POJO or a nested
|
||||||
* Map.
|
* Map.
|
||||||
*
|
*
|
||||||
* @author Meang Akira Tanaka
|
* @author Meang Akira Tanaka
|
||||||
|
@ -100,13 +100,13 @@ public final class Info {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Record detail using {@code key} and {@code value}.
|
* Record detail using given {@code key} and {@code value}.
|
||||||
* @param key the detail key
|
* @param key the detail key
|
||||||
* @param data the detail data
|
* @param value the detail value
|
||||||
* @return this {@link Builder} instance
|
* @return this {@link Builder} instance
|
||||||
*/
|
*/
|
||||||
public Builder withDetail(String key, Object data) {
|
public Builder withDetail(String key, Object value) {
|
||||||
this.content.put(key, data);
|
this.content.put(key, value);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@ public final class Info {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create a new {@link Info} instance base on the state of this builder.
|
* Create a new {@link Info} instance based on the state of this builder.
|
||||||
* @return a new {@link Info} instance
|
* @return a new {@link Info} instance
|
||||||
*/
|
*/
|
||||||
public Info build() {
|
public Info build() {
|
||||||
|
|
|
@ -69,7 +69,7 @@ public class InfoContributorAutoConfigurationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void defaultInfoContributorsDisabledWithCustomOne() {
|
public void defaultInfoContributorsDisabledWithCustomOne() {
|
||||||
load(CustomInfoProviderConfiguration.class,
|
load(CustomInfoContributorConfiguration.class,
|
||||||
"management.info.defaults.enabled:false");
|
"management.info.defaults.enabled:false");
|
||||||
Map<String, InfoContributor> beans = this.context
|
Map<String, InfoContributor> beans = this.context
|
||||||
.getBeansOfType(InfoContributor.class);
|
.getBeansOfType(InfoContributor.class);
|
||||||
|
@ -108,7 +108,7 @@ public class InfoContributorAutoConfigurationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void customGitInfoContributor() {
|
public void customGitInfoContributor() {
|
||||||
load(CustomGitInfoProviderConfiguration.class);
|
load(CustomGitInfoContributorConfiguration.class);
|
||||||
assertThat(this.context.getBean(GitInfoContributor.class))
|
assertThat(this.context.getBean(GitInfoContributor.class))
|
||||||
.isSameAs(this.context.getBean("customGitInfoContributor"));
|
.isSameAs(this.context.getBean("customGitInfoContributor"));
|
||||||
}
|
}
|
||||||
|
@ -143,7 +143,7 @@ public class InfoContributorAutoConfigurationTests {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void customBuildInfoContributor() {
|
public void customBuildInfoContributor() {
|
||||||
load(CustomBuildInfoProviderConfiguration.class);
|
load(CustomBuildInfoContributorConfiguration.class);
|
||||||
assertThat(this.context.getBean(BuildInfoContributor.class))
|
assertThat(this.context.getBean(BuildInfoContributor.class))
|
||||||
.isSameAs(this.context.getBean("customBuildInfoContributor"));
|
.isSameAs(this.context.getBean("customBuildInfoContributor"));
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@ public class InfoContributorAutoConfigurationTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
static class CustomInfoProviderConfiguration {
|
static class CustomInfoContributorConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public InfoContributor customInfoContributor() {
|
public InfoContributor customInfoContributor() {
|
||||||
|
@ -212,7 +212,7 @@ public class InfoContributorAutoConfigurationTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
static class CustomGitInfoProviderConfiguration {
|
static class CustomGitInfoContributorConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public GitInfoContributor customGitInfoContributor() {
|
public GitInfoContributor customGitInfoContributor() {
|
||||||
|
@ -222,7 +222,7 @@ public class InfoContributorAutoConfigurationTests {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
static class CustomBuildInfoProviderConfiguration {
|
static class CustomBuildInfoContributorConfiguration {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public BuildInfoContributor customBuildInfoContributor() {
|
public BuildInfoContributor customBuildInfoContributor() {
|
||||||
|
|
|
@ -52,7 +52,7 @@ public class InfoEndpointTests extends AbstractEndpointTests<InfoEndpoint> {
|
||||||
public static class Config {
|
public static class Config {
|
||||||
|
|
||||||
@Bean
|
@Bean
|
||||||
public InfoContributor infoProvider() {
|
public InfoContributor infoContributor() {
|
||||||
return new InfoContributor() {
|
return new InfoContributor() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -49,7 +49,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link InfoMvcEndpointTests}
|
* Tests for {@link InfoEndpoint} with {@link MockMvc}.
|
||||||
*
|
*
|
||||||
* @author Meang Akira Tanaka
|
* @author Meang Akira Tanaka
|
||||||
* @author Stephane Nicoll
|
* @author Stephane Nicoll
|
||||||
|
|
|
@ -43,13 +43,14 @@ import static org.springframework.test.web.servlet.request.MockMvcRequestBuilder
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link InfoMvcEndpointWithoutAnyInfoProvidersTests}
|
* Tests for {@link InfoEndpoint} with {@link MockMvc} when there are no
|
||||||
|
* {@link InfoContributor InfoContributors}.
|
||||||
*
|
*
|
||||||
* @author Meang Akira Tanaka
|
* @author Meang Akira Tanaka
|
||||||
*/
|
*/
|
||||||
@RunWith(SpringRunner.class)
|
@RunWith(SpringRunner.class)
|
||||||
@SpringBootTest
|
@SpringBootTest
|
||||||
public class InfoMvcEndpointWithoutAnyInfoProvidersTests {
|
public class InfoMvcEndpointWithNoInfoContributorsTests {
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private WebApplicationContext context;
|
private WebApplicationContext context;
|
||||||
|
@ -58,7 +59,6 @@ public class InfoMvcEndpointWithoutAnyInfoProvidersTests {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void setUp() {
|
public void setUp() {
|
||||||
|
|
||||||
this.context.getBean(InfoEndpoint.class).setEnabled(true);
|
this.context.getBean(InfoEndpoint.class).setEnabled(true);
|
||||||
this.mvc = MockMvcBuilders.webAppContextSetup(this.context).build();
|
this.mvc = MockMvcBuilders.webAppContextSetup(this.context).build();
|
||||||
}
|
}
|
|
@ -49,6 +49,8 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||||
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Tests for {@link JolokiaMvcEndpoint} with a custom management context path.
|
||||||
|
*
|
||||||
* @author Christian Dupuis
|
* @author Christian Dupuis
|
||||||
* @author Dave Syer
|
* @author Dave Syer
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -30,7 +30,7 @@ import org.springframework.util.ClassUtils;
|
||||||
import static org.assertj.core.api.Assertions.assertThat;
|
import static org.assertj.core.api.Assertions.assertThat;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tests for {@link ImportAutoConfigurationTests}.
|
* Tests for {@link ImportAutoConfiguration}.
|
||||||
*
|
*
|
||||||
* @author Phillip Webb
|
* @author Phillip Webb
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -969,12 +969,12 @@ content into your application; rather pick only the properties that you need.
|
||||||
# INFO CONTRIBUTORS
|
# INFO CONTRIBUTORS
|
||||||
management.info.build.enabled=true # Enable build info.
|
management.info.build.enabled=true # Enable build info.
|
||||||
management.info.build.mode=simple # Mode to use to expose build information.
|
management.info.build.mode=simple # Mode to use to expose build information.
|
||||||
management.info.defaults.enabled=true # Enable default health indicators.
|
management.info.defaults.enabled=true # Enable default info contributors.
|
||||||
management.info.env.enabled=true # Enable environment info.
|
management.info.env.enabled=true # Enable environment info.
|
||||||
management.info.git.enabled=true # Enable git info.
|
management.info.git.enabled=true # Enable git info.
|
||||||
management.info.git.mode=simple # Mode to use to expose git information.
|
management.info.git.mode=simple # Mode to use to expose git information.
|
||||||
|
|
||||||
# TRACING (({sc-spring-boot-actuator}/trace/TraceProperties.{sc-ext}[TraceProperties])
|
# TRACING ({sc-spring-boot-actuator}/trace/TraceProperties.{sc-ext}[TraceProperties])
|
||||||
management.trace.include=request-headers,response-headers,errors # Items to be included in the trace.
|
management.trace.include=request-headers,response-headers,errors # Items to be included in the trace.
|
||||||
|
|
||||||
# REMOTE SHELL
|
# REMOTE SHELL
|
||||||
|
|
|
@ -83,7 +83,7 @@ public class PropertySourcesBinder {
|
||||||
/**
|
/**
|
||||||
* Extract the keys using the specified {@code prefix}. The prefix won't be included.
|
* Extract the keys using the specified {@code prefix}. The prefix won't be included.
|
||||||
* <p>
|
* <p>
|
||||||
* Any key that starts with the {@code prefix} will be included
|
* Any key that starts with the {@code prefix} will be included.
|
||||||
* @param prefix the prefix to use
|
* @param prefix the prefix to use
|
||||||
* @return the keys matching the prefix
|
* @return the keys matching the prefix
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in New Issue