Exclude null and empty properties from /autoconfig

pull/300/head
Dave Syer 11 years ago
parent a21397dbe2
commit 2bd6026a2a

@ -32,6 +32,8 @@ import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.StringUtils;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
/**
@ -60,6 +62,7 @@ public class AutoConfigurationReportEndpoint extends AbstractEndpoint<Report> {
* Adapts {@link AutoConfigurationReport} to a JSON friendly structure.
*/
@JsonPropertyOrder({ "positiveMatches", "negativeMatches" })
@JsonInclude(Include.NON_EMPTY)
public static class Report {
private MultiValueMap<String, MessageAndCondition> positiveMatches;

@ -112,9 +112,7 @@ public class AutoConfigurationReportTests {
this.beanFactory.setParentBeanFactory(new DefaultListableBeanFactory());
AutoConfigurationReport.get((ConfigurableListableBeanFactory) this.beanFactory
.getParentBeanFactory());
this.report = AutoConfigurationReport.get(this.beanFactory); // NB: overrides
// setup
this.report = AutoConfigurationReport.get(this.beanFactory);
assertThat(this.report, not(nullValue()));
assertThat(this.report, not(sameInstance(this.report.getParent())));
assertThat(this.report.getParent(), not(nullValue()));

Loading…
Cancel
Save