Skip to content

Conversation

nosan
Copy link
Contributor

@nosan nosan commented Apr 25, 2025

See #45295

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Apr 25, 2025
Previously, only a single TaskDecorator bean, if unique, was applied
to the auto-configured TaskExecutor or Scheduler. With this change,
if multiple TaskDecorator beans are defined, they will be combined
into a `CompositeTaskDecorator` and applied accordingly.

Signed-off-by: Dmytro Nosan <dimanosan@gmail.com>
@@ -451,6 +485,10 @@ void shouldNotAliasApplicationTaskExecutorWhenBootstrapExecutorAliasIsDefined()
});
}

private TaskDecorator createTaskDecorator() {
return (runnable) -> runnable;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A custom implementation instead of Mockito.mock(TaskDecorator.class) to avoid this exception

Exception in thread "scheduling-1" java.lang.NullPointerException: Cannot invoke "java.lang.Runnable.run()" because "this.decoratedRunnable" is null
	at org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler$DelegatingRunnableScheduledFuture.run(ThreadPoolTaskScheduler.java:508)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
	at java.base/java.lang.Thread.run(Thread.java:840)

@snicoll snicoll added type: enhancement A general enhancement and removed status: waiting-for-triage An issue we've not yet triaged labels Apr 30, 2025
@snicoll snicoll added this to the 4.x milestone Apr 30, 2025
@wilkinsona wilkinsona modified the milestones: 4.x, 4.0.x Jul 2, 2025
@wilkinsona wilkinsona self-assigned this Jul 2, 2025
@wilkinsona wilkinsona modified the milestones: 4.0.x, 4.0.0-M1 Jul 2, 2025
wilkinsona pushed a commit that referenced this pull request Jul 2, 2025
Previously, only a single TaskDecorator bean, if unique, was applied
to the auto-configured TaskExecutor or Scheduler. With this change,
if multiple TaskDecorator beans are defined, they will be combined
into a `CompositeTaskDecorator` and applied accordingly.

Signed-off-by: Dmytro Nosan <dimanosan@gmail.com>

See gh-45302
@wilkinsona wilkinsona closed this in 95ba981 Jul 2, 2025
@wilkinsona
Copy link
Member

Thanks very much, @nosan.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants