mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Exclude null and empty properties from /autoconfig
This commit is contained in:
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…
Reference in New Issue
Block a user