Skip to content

Commit

Permalink
remove redundant virtual thread configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
emmysteven committed Nov 25, 2023
1 parent b8a34c5 commit ca2b182
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions src/main/java/configa/Application.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,30 +2,12 @@

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.web.embedded.tomcat.TomcatProtocolHandlerCustomizer;
import org.springframework.cloud.config.server.EnableConfigServer;
import org.springframework.context.annotation.Bean;
import org.springframework.core.task.AsyncTaskExecutor;
import org.springframework.core.task.support.TaskExecutorAdapter;

import java.util.concurrent.Executors;

@SpringBootApplication
@EnableConfigServer
@ConditionalOnProperty(value = "spring.thread-executor", havingValue = "virtual")
public class Application {

@Bean
public AsyncTaskExecutor asyncTaskExecutor() {
return new TaskExecutorAdapter(Executors.newVirtualThreadPerTaskExecutor());
}

@Bean
public TomcatProtocolHandlerCustomizer<?> protocolHandlerCustomizer() {
return protocolHandler -> protocolHandler.setExecutor(Executors.newVirtualThreadPerTaskExecutor());
}

public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
Expand Down

0 comments on commit ca2b182

Please sign in to comment.