Properly evaluate @Conditional in case of multiple imports for same config class (fixing regression in Spring Boot)
Issue: SPR-11788
This commit is contained in:
parent
748167bfa3
commit
7d78c65187
|
@ -395,6 +395,7 @@ class ConfigurationClassBeanDefinitionReader {
|
|||
for (ConfigurationClass importedBy : configClass.getImportedBy()) {
|
||||
if (!shouldSkip(importedBy)) {
|
||||
allSkipped = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (allSkipped) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -19,40 +19,40 @@ package org.springframework.context.annotation;
|
|||
/**
|
||||
* A {@link Condition} that offers more fine-grained control when used with
|
||||
* {@code @Configuration}. Allows certain {@link Condition}s to adapt when they match
|
||||
* based on the configuration phase. For example, a condition that checks if a bean has
|
||||
* already been registered might choose to only be evaluated during the
|
||||
* based on the configuration phase. For example, a condition that checks if a bean
|
||||
* has already been registered might choose to only be evaluated during the
|
||||
* {@link ConfigurationPhase#REGISTER_BEAN REGISTER_BEAN} {@link ConfigurationPhase}.
|
||||
*
|
||||
* @author Phillip Webb
|
||||
* @since 4.0
|
||||
* @see Configuration
|
||||
*/
|
||||
public interface ConfigurationCondition extends Condition {
|
||||
|
||||
/**
|
||||
* Returns the {@link ConfigurationPhase} in which the condition should be evaluated.
|
||||
* Return the {@link ConfigurationPhase} in which the condition should be evaluated.
|
||||
*/
|
||||
ConfigurationPhase getConfigurationPhase();
|
||||
|
||||
|
||||
/**
|
||||
* The various configuration phases where the condition could be evaluated.
|
||||
*/
|
||||
public static enum ConfigurationPhase {
|
||||
|
||||
/**
|
||||
* The {@link Condition} should be evaluated as a {@code @Configuration} class is
|
||||
* being parsed.
|
||||
*
|
||||
* <p>If the condition does not match at this point the {@code @Configuration}
|
||||
* The {@link Condition} should be evaluated as a {@code @Configuration}
|
||||
* class is being parsed.
|
||||
* <p>If the condition does not match at this point, the {@code @Configuration}
|
||||
* class will not be added.
|
||||
*/
|
||||
PARSE_CONFIGURATION,
|
||||
|
||||
/**
|
||||
* The {@link Condition} should be evaluated when adding a regular (non
|
||||
* {@code @Configuration}) bean. The condition will not prevent
|
||||
* The {@link Condition} should be evaluated when adding a regular
|
||||
* (non {@code @Configuration}) bean. The condition will not prevent
|
||||
* {@code @Configuration} classes from being added.
|
||||
*
|
||||
* <p>At the time that the condition is evaluated all {@code @Configuration}s
|
||||
* <p>At the time that the condition is evaluated, all {@code @Configuration}s
|
||||
* will have been parsed.
|
||||
*/
|
||||
REGISTER_BEAN
|
||||
|
|
Loading…
Reference in New Issue