Example usage for org.springframework.boot.autoconfigure.condition ConditionEvaluationReport getConditionAndOutcomesBySource

List of usage examples for org.springframework.boot.autoconfigure.condition ConditionEvaluationReport getConditionAndOutcomesBySource

Introduction

In this page you can find the example usage for org.springframework.boot.autoconfigure.condition ConditionEvaluationReport getConditionAndOutcomesBySource.

Prototype

public Map<String, ConditionAndOutcomes> getConditionAndOutcomesBySource() 

Source Link

Document

Returns condition outcomes from this report, grouped by the source.

Usage

From source file:org.springframework.boot.autoconfigure.logging.AutoConfigurationReportLoggingInitializer.java

private StringBuilder getLogMessage(ConditionEvaluationReport report) {
    StringBuilder message = new StringBuilder();
    message.append("\n\n\n");
    message.append("=========================\n");
    message.append("AUTO-CONFIGURATION REPORT\n");
    message.append("=========================\n\n\n");
    message.append("Positive matches:\n");
    message.append("-----------------\n");
    Map<String, ConditionAndOutcomes> shortOutcomes = orderByName(report.getConditionAndOutcomesBySource());
    for (Map.Entry<String, ConditionAndOutcomes> entry : shortOutcomes.entrySet()) {
        if (entry.getValue().isFullMatch()) {
            addLogMessage(message, entry.getKey(), entry.getValue());
        }//from w  w  w.  ja  v  a 2  s  .  c  om
    }
    message.append("\n\n");
    message.append("Negative matches:\n");
    message.append("-----------------\n");
    for (Map.Entry<String, ConditionAndOutcomes> entry : shortOutcomes.entrySet()) {
        if (!entry.getValue().isFullMatch()) {
            addLogMessage(message, entry.getKey(), entry.getValue());
        }
    }
    message.append("\n\n");
    message.append("Exclusions:\n");
    message.append("-----------\n");
    if (report.getExclusions().isEmpty()) {
        message.append("\n    None\n");
    } else {
        for (String exclusion : report.getExclusions()) {
            message.append("\n   " + exclusion + "\n");
        }
    }
    message.append("\n\n");
    message.append("Unconditional classes:\n");
    message.append("----------------------\n");
    if (report.getUnconditionalClasses().isEmpty()) {
        message.append("\n    None\n");
    } else {
        for (String unconditionalClass : report.getUnconditionalClasses()) {
            message.append("\n   " + unconditionalClass + "\n");
        }
    }
    message.append("\n\n");
    return message;
}

From source file:org.springframework.boot.devtools.autoconfigure.ConditionEvaluationDeltaLoggingListener.java

@Override
public void onApplicationEvent(ApplicationReadyEvent event) {
    ConditionEvaluationReport report = event.getApplicationContext().getBean(ConditionEvaluationReport.class);
    if (previousReport != null) {
        ConditionEvaluationReport delta = report.getDelta(previousReport);
        if (!delta.getConditionAndOutcomesBySource().isEmpty() || !delta.getExclusions().isEmpty()
                || !delta.getUnconditionalClasses().isEmpty()) {
            if (this.logger.isInfoEnabled()) {
                this.logger.info("Condition evaluation delta:"
                        + new ConditionEvaluationReportMessage(delta, "CONDITION EVALUATION DELTA"));
            }//from   w ww.  j a v a2  s.  co  m
        } else {
            this.logger.info("Condition evaluation unchanged");
        }
    }
    previousReport = report;
}