List of usage examples for org.springframework.boot.autoconfigure.condition ConditionEvaluationReport get
public static ConditionEvaluationReport get(ConfigurableListableBeanFactory beanFactory)
From source file:org.springframework.boot.autoconfigure.condition.SpringBootCondition.java
private void recordEvaluation(ConditionContext context, String classOrMethodName, ConditionOutcome outcome) { if (context.getBeanFactory() != null) { ConditionEvaluationReport.get(context.getBeanFactory()).recordConditionEvaluation(classOrMethodName, this, outcome); }/*from w ww . j a v a2s .c om*/ }
From source file:org.springframework.boot.autoconfigure.logging.AutoConfigurationReportLoggingInitializer.java
@Override public void initialize(ConfigurableApplicationContext applicationContext) { this.applicationContext = applicationContext; applicationContext.addApplicationListener(new AutoConfigurationReportListener()); if (applicationContext instanceof GenericApplicationContext) { // Get the report early in case the context fails to load this.report = ConditionEvaluationReport.get(this.applicationContext.getBeanFactory()); }// www . j av a 2s . c o m }
From source file:org.springframework.boot.autoconfigure.logging.AutoConfigurationReportLoggingInitializer.java
public void logAutoConfigurationReport(boolean isCrashReport) { if (this.report == null) { if (this.applicationContext == null) { this.logger .info("Unable to provide auto-configuration report " + "due to missing ApplicationContext"); return; }/*from w w w. j a v a2s .c o m*/ this.report = ConditionEvaluationReport.get(this.applicationContext.getBeanFactory()); } if (this.report.getConditionAndOutcomesBySource().size() > 0) { if (isCrashReport && this.logger.isInfoEnabled() && !this.logger.isDebugEnabled()) { this.logger.info("\n\nError starting ApplicationContext. " + "To display the auto-configuration report enable " + "debug logging (start with --debug)\n\n"); } if (this.logger.isDebugEnabled()) { this.logger.debug(getLogMessage(this.report)); } } }
From source file:org.springframework.boot.autoconfigure.logging.AutoConfigurationReportLoggingInitializerTests.java
@Test public void logsOutput() throws Exception { AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext(); this.initializer.initialize(context); context.register(Config.class); ConditionEvaluationReport.get(context.getBeanFactory()).recordExclusions(Arrays.asList("com.foo.Bar")); context.refresh();//from w w w . ja va 2s. c om this.initializer.onApplicationEvent(new ContextRefreshedEvent(context)); for (String message : this.debugLog) { System.out.println(message); } // Just basic sanity check, test is for visual inspection String l = this.debugLog.get(0); assertThat(l, containsString("not a web application (OnWebApplicationCondition)")); }
From source file:org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener.java
@Override public void initialize(ConfigurableApplicationContext applicationContext) { this.applicationContext = applicationContext; applicationContext.addApplicationListener(new ConditionEvaluationReportListener()); if (applicationContext instanceof GenericApplicationContext) { // Get the report early in case the context fails to load this.report = ConditionEvaluationReport.get(this.applicationContext.getBeanFactory()); }/*from w w w . jav a2 s . c o m*/ }
From source file:org.springframework.boot.autoconfigure.logging.ConditionEvaluationReportLoggingListener.java
public void logAutoConfigurationReport(boolean isCrashReport) { if (this.report == null) { if (this.applicationContext == null) { this.logger.info("Unable to provide the conditions report " + "due to missing ApplicationContext"); return; }/*from www. j a va2 s . co m*/ this.report = ConditionEvaluationReport.get(this.applicationContext.getBeanFactory()); } if (!this.report.getConditionAndOutcomesBySource().isEmpty()) { if (this.getLogLevelForReport().equals(LogLevel.INFO)) { if (this.logger.isInfoEnabled()) { this.logger.info(new ConditionEvaluationReportMessage(this.report)); } else if (isCrashReport) { logMessage("info"); } } else { if (isCrashReport && this.logger.isInfoEnabled() && !this.logger.isDebugEnabled()) { logMessage("debug"); } if (this.logger.isDebugEnabled()) { this.logger.debug(new ConditionEvaluationReportMessage(this.report)); } } } }