Skip to content

Commit 7d78c65

Browse files
committed
Properly evaluate @conditional in case of multiple imports for same config class (fixing regression in Spring Boot)
Issue: SPR-11788
1 parent 748167b commit 7d78c65

File tree

2 files changed

+13
-12
lines changed

2 files changed

+13
-12
lines changed

spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassBeanDefinitionReader.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ public boolean shouldSkip(ConfigurationClass configClass) {
395395
for (ConfigurationClass importedBy : configClass.getImportedBy()) {
396396
if (!shouldSkip(importedBy)) {
397397
allSkipped = false;
398+
break;
398399
}
399400
}
400401
if (allSkipped) {

spring-context/src/main/java/org/springframework/context/annotation/ConfigurationCondition.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2013 the original author or authors.
2+
* Copyright 2002-2014 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,40 +19,40 @@
1919
/**
2020
* A {@link Condition} that offers more fine-grained control when used with
2121
* {@code @Configuration}. Allows certain {@link Condition}s to adapt when they match
22-
* based on the configuration phase. For example, a condition that checks if a bean has
23-
* already been registered might choose to only be evaluated during the
22+
* based on the configuration phase. For example, a condition that checks if a bean
23+
* has already been registered might choose to only be evaluated during the
2424
* {@link ConfigurationPhase#REGISTER_BEAN REGISTER_BEAN} {@link ConfigurationPhase}.
2525
*
2626
* @author Phillip Webb
2727
* @since 4.0
28+
* @see Configuration
2829
*/
2930
public interface ConfigurationCondition extends Condition {
3031

3132
/**
32-
* Returns the {@link ConfigurationPhase} in which the condition should be evaluated.
33+
* Return the {@link ConfigurationPhase} in which the condition should be evaluated.
3334
*/
3435
ConfigurationPhase getConfigurationPhase();
3536

37+
3638
/**
3739
* The various configuration phases where the condition could be evaluated.
3840
*/
3941
public static enum ConfigurationPhase {
4042

4143
/**
42-
* The {@link Condition} should be evaluated as a {@code @Configuration} class is
43-
* being parsed.
44-
*
45-
* <p>If the condition does not match at this point the {@code @Configuration}
44+
* The {@link Condition} should be evaluated as a {@code @Configuration}
45+
* class is being parsed.
46+
* <p>If the condition does not match at this point, the {@code @Configuration}
4647
* class will not be added.
4748
*/
4849
PARSE_CONFIGURATION,
4950

5051
/**
51-
* The {@link Condition} should be evaluated when adding a regular (non
52-
* {@code @Configuration}) bean. The condition will not prevent
52+
* The {@link Condition} should be evaluated when adding a regular
53+
* (non {@code @Configuration}) bean. The condition will not prevent
5354
* {@code @Configuration} classes from being added.
54-
*
55-
* <p>At the time that the condition is evaluated all {@code @Configuration}s
55+
* <p>At the time that the condition is evaluated, all {@code @Configuration}s
5656
* will have been parsed.
5757
*/
5858
REGISTER_BEAN

0 commit comments

Comments
 (0)