-
Notifications
You must be signed in to change notification settings - Fork 64
Expand file tree
/
Copy pathAuthMicroservice.java
More file actions
39 lines (29 loc) · 1.16 KB
/
AuthMicroservice.java
File metadata and controls
39 lines (29 loc) · 1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package microservice;
import org.springframework.boot.SpringApplication;
import org.springframework.core.task.TaskExecutor;
import org.springframework.context.annotation.Bean;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class AuthMicroservice {
@Value("${thread.pool.core.size}")
private int corePoolSize;
@Value("${thread.pool.max.size}")
private int maxPoolSize;
@Value("${thread.queue.capacity}")
private int queueCapacity;
@Bean(name = "ThreadPoolExecutor")
public TaskExecutor getAsyncExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(corePoolSize);
executor.setMaxPoolSize(maxPoolSize);
executor.setQueueCapacity(queueCapacity);
executor.setThreadNamePrefix("ThreadPoolExecutor-");
executor.initialize();
return executor;
}
public static void main(String[] args) {
SpringApplication.run(AuthMicroservice.class, args);
}
}