Skip to content

Commit 48e77ee

Browse files
committed
Merge pull request #33276 from hpoettker
* pr/33276: Make `ScheduledBeanLazyInitializationExcludeFilter` conditional Closes gh-33276
2 parents a23c7df + 330848d commit 48e77ee

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfiguration.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2022 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.
@@ -56,6 +56,7 @@ public ThreadPoolTaskScheduler taskScheduler(TaskSchedulerBuilder builder) {
5656
}
5757

5858
@Bean
59+
@ConditionalOnBean(name = TaskManagementConfigUtils.SCHEDULED_ANNOTATION_PROCESSOR_BEAN_NAME)
5960
public static LazyInitializationExcludeFilter scheduledBeanLazyInitializationExcludeFilter() {
6061
return new ScheduledBeanLazyInitializationExcludeFilter();
6162
}

spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/task/TaskSchedulingAutoConfigurationTests.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2021 the original author or authors.
2+
* Copyright 2012-2022 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.
@@ -61,6 +61,12 @@ void noSchedulingDoesNotExposeTaskScheduler() {
6161
this.contextRunner.run((context) -> assertThat(context).doesNotHaveBean(TaskScheduler.class));
6262
}
6363

64+
@Test
65+
void noSchedulingDoesNotExposeScheduledBeanLazyInitializationExcludeFilter() {
66+
this.contextRunner.run(
67+
(context) -> assertThat(context).doesNotHaveBean(ScheduledBeanLazyInitializationExcludeFilter.class));
68+
}
69+
6470
@Test
6571
void enableSchedulingWithNoTaskExecutorAutoConfiguresOne() {
6672
this.contextRunner

0 commit comments

Comments
 (0)