You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
TrackedConditionEvaluator skips loading bean definitions for configuration classes that should not be skipped [SPR-17153] #21690
in: coreIssues in core modules (aop, beans, core, context, expression)status: declinedA suggestion or change that we don't feel we should currently apply
Currently we are facing a complex issue with autoconfigurations that are marked with @EnableScheduling. I have created sample project that reproduces an issue.
It consists of 4 modules:
library-0 module
This module defines Library0AutoConfiguration that has @EnableScheduling and @AutoConfigureBefore(name = "org.library1.Library1AutoConfiguration"). It will not start because of unsatisfied @ConditionalOnBean (bean is not present in context).
library-1 module
This module defines Library1AutoConfiguration that has @AutoConfigureBefore(name = "org.library2.Library2AutoConfiguration").
library-2 module
This module defines Library2AutoConfiguration that has @EnableScheduling and @Conditional on bean of type Library1.class.
service module
This module imports: library-0, library-1 and library-2 and enables autoconfiguration.
There is test ServiceConfigurationTest that can be run to reproduce an issue:
Actual result: both Library1AutoConfiguration and Library2AutoConfiguration should start, because they do not have dependency on Library0AutoConfiguration, but instead Library2AutoConfiguration will not start and test will fail.Removing @EnableScheduling from Library0AutoConfiguration fixes an issue.
We have found that TrackedConditionEvaluator.shouldSkip for org.springframework.scheduling.annotation.SchedulingConfiguration skips loading bean definitions for Library2AutoConfiguration.
Closed along with #20765 since we do not intend to revisit the condition handling for configuration classes anymore, accepting its present quirks over making it even more complex.
in: coreIssues in core modules (aop, beans, core, context, expression)status: declinedA suggestion or change that we don't feel we should currently apply
Activity
jhoeller commentedon Dec 29, 2023
Closed along with #20765 since we do not intend to revisit the condition handling for configuration classes anymore, accepting its present quirks over making it even more complex.