Exclude null and empty properties from /autoconfig

This commit is contained in:
Dave Syer 2014-01-30 10:37:22 +00:00
parent a21397dbe2
commit 2bd6026a2a
2 changed files with 4 additions and 3 deletions

View File

@ -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;

View File

@ -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()));