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

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

Introduction

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

Prototype

public List<String> getExclusions() 

Source Link

Document

Returns the names of the classes that have been excluded from condition evaluation.

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());
        }/* w w w. j av  a2 s .c  o m*/
    }
    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  av  a  2 s .c o m*/
        } else {
            this.logger.info("Condition evaluation unchanged");
        }
    }
    previousReport = report;
}