spring-projects / spring-projects/spring-framework
Provide a hook point that a Configuration class was skipped [SPR-17066]
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 60.2k
- Forks
- 38.8k
- Avg merge
- 5d 2h
- Merged PRs (30d)
- 27
Description
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with ConditionEvaluationReport and TrackedConditionEvaluator, using the Config, Child, and REGISTER_BEAN example in the issue to understand when imported configuration is later excluded. Determine how the framework can expose that exclusion to Spring Boot so the report can update when processing is skipped.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100