-
Notifications
You must be signed in to change notification settings - Fork 41.6k
Closed
Labels
for: external-projectFor an external project and not something we can fixFor an external project and not something we can fix
Description
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 definesLibrary0AutoConfigurationthat has@EnableSchedulingand@AutoConfigureBefore(name = "org.library1.Library1AutoConfiguration"). It will not start because of unsatisfied @ConditionalOnBean (bean is not present in context). - library-1 module
This module definesLibrary1AutoConfigurationthat has@AutoConfigureBefore(name = "org.library2.Library2AutoConfiguration"). - library-2 module
This module definesLibrary2AutoConfigurationthat has@EnableSchedulingand@Conditionalon bean of typeLibrary1.class. - service module
This module imports:library-0,library-1andlibrary-2and enables autoconfiguration.
There is testServiceConfigurationTestthat can be run to reproduce an issue:
@SpringBootTest(
webEnvironment = SpringBootTest.WebEnvironment.NONE,
classes = ServiceConfiguration.class
)
@RunWith(SpringRunner.class)
public class ServiceConfigurationTest {
@Autowired
Library1 library1;
@Autowired
Library2 library2;
@Test
public void beans_should_be_present() throws Exception {
assertNotNull(library1);
assertNotNull(library2);
}
}
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.
Spring Boot version 1.5.13
tdanylchuk and spolyakov
Metadata
Metadata
Assignees
Labels
for: external-projectFor an external project and not something we can fixFor an external project and not something we can fix