Skip to content

I am using Spring Boot WebFlux, and I want to enable virtual threads #39425

@MrWangGang

Description

@MrWangGang

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
</dependency>

I am using the above dependency to build my application, and I am also using JDK 21. I want to leverage the new feature of JDK 21 - virtual threads. I have set
spring.threads.virtual.enabled=true
to enable virtual threads. I created an endpoint to test whether virtual threads are running:

@PostMapping("/test")
public Mono<Void> test() {
System.out.println("----->>>>>>>> " + Thread.currentThread());
return Mono.empty();
}

However, the output of System.out shows:
----->>>>>>>>Thread[#75,reactor-http-nio-2,5,main]
This clearly indicates a traditional thread name. I am unsure why virtual threads are not taking effect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    for: external-projectFor an external project and not something we can fixstatus: invalidAn issue that we don't feel is valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      close