Skip to content

Fix virtual threads optimized test for Spring Boot 4.0.4#1732

Merged
Croway merged 1 commit intomainfrom
fix-virtual-threads-optimized-test
Mar 27, 2026
Merged

Fix virtual threads optimized test for Spring Boot 4.0.4#1732
Croway merged 1 commit intomainfrom
fix-virtual-threads-optimized-test

Conversation

@Croway
Copy link
Copy Markdown
Contributor

@Croway Croway commented Mar 27, 2026

Summary

  • Fix SpringBootPlatformHttpVirtualThreadsOptimizedTest.testVirtualThreadExecutorIsPreferred which fails because Spring Boot 4.0.4's TaskExecutionAutoConfiguration uses @ConditionalOnMissingBean(Executor.class) when auto-configuring SimpleAsyncTaskExecutor for virtual threads. When another Executor bean is registered first (e.g. by Spring Security auto-configuration), the auto-config backs off and no SimpleAsyncTaskExecutor is created.
  • Explicitly define a SimpleAsyncTaskExecutor bean in the test's TestConfiguration using SimpleAsyncTaskExecutorBuilder, matching the approach used by the passing SpringBootPlatformHttpMultipleExecutorsVirtualThreadsTest.

Test plan

  • Verify SpringBootPlatformHttpVirtualThreadsOptimizedTest.testVirtualThreadExecutorIsPreferred passes
  • Verify other virtual threads tests (SpringBootPlatformHttpMultipleExecutorsVirtualThreadsTest, SpringBootPlatformHttpVirtualThreadsTest) still pass

🤖 Generated with Claude Code on behalf of Federico Mariani

… 4.0.4

Spring Boot 4.0.4's TaskExecutionAutoConfiguration uses
@ConditionalOnMissingBean(Executor.class) when auto-configuring the
SimpleAsyncTaskExecutor for virtual threads. When another Executor bean
is registered first (e.g. by Spring Security auto-configuration), the
auto-config backs off and no SimpleAsyncTaskExecutor is created, causing
the test assertion to fail.

Explicitly define a SimpleAsyncTaskExecutor bean in the test's
TestConfiguration using SimpleAsyncTaskExecutorBuilder, matching the
approach used by the passing
SpringBootPlatformHttpMultipleExecutorsVirtualThreadsTest.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@Croway Croway merged commit 157cdd9 into main Mar 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants