Stéphane Nicoll opened SPR-17066 and commented
Spring Boot has a ConditionEvaluationReport
that keeps track of conditions evaluations but can lead to wrong information as an important bit of information is not available.
Consider the following example
@Configuration
@MyRegisterBeanCondition
@Import(Child.class)
public class Config { ... }
As the condition is in the REGISTER_BEAN
phase, the configuration class will be parsed and its import directive will be applied, parsing Child
in the process.
If the condition doesn't match TrackedConditionEvaluator
will figure out that Config
was excluded after all. As a result Child
will not instantiated either. This process of figuring out that a REGISTER_BEAN
condition didn't match and therefore the class shouldn't be imported is internal to the framework and there is no way for Spring Boot to know.
It would be nice to have a way to access this information. Ideally in a push model-like so that the report can update itself when the context realizes that a given class shouldn't be processed after all.
Affects: 4.3.18