mirror of
				https://github.com/dromara/RuoYi-Vue-Plus.git
				synced 2025-11-04 08:13:44 +08:00 
			
		
		
		
	update 优化 Async 针对虚拟线程配置 与其他注意事项注释
This commit is contained in:
		@@ -231,6 +231,7 @@ xss:
 | 
			
		||||
  urlPatterns: /system/*,/monitor/*,/tool/*
 | 
			
		||||
 | 
			
		||||
# 全局线程池相关配置
 | 
			
		||||
# 如使用JDK21请直接使用虚拟线程 不要开启此配置
 | 
			
		||||
thread-pool:
 | 
			
		||||
  # 是否开启线程池
 | 
			
		||||
  enabled: false
 | 
			
		||||
 
 | 
			
		||||
@@ -2,6 +2,7 @@ package org.dromara.common.core.config;
 | 
			
		||||
 | 
			
		||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
 | 
			
		||||
import org.springframework.context.annotation.EnableAspectJAutoProxy;
 | 
			
		||||
import org.springframework.scheduling.annotation.EnableAsync;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 程序注解配置
 | 
			
		||||
@@ -11,6 +12,7 @@ import org.springframework.context.annotation.EnableAspectJAutoProxy;
 | 
			
		||||
@AutoConfiguration
 | 
			
		||||
// 表示通过aop框架暴露该代理对象,AopContext能够访问
 | 
			
		||||
@EnableAspectJAutoProxy(exposeProxy = true)
 | 
			
		||||
@EnableAsync(proxyTargetClass = true)
 | 
			
		||||
public class ApplicationConfig {
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -5,18 +5,20 @@ import org.dromara.common.core.exception.ServiceException;
 | 
			
		||||
import org.dromara.common.core.utils.SpringUtils;
 | 
			
		||||
import org.springframework.aop.interceptor.AsyncUncaughtExceptionHandler;
 | 
			
		||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
 | 
			
		||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
 | 
			
		||||
import org.springframework.scheduling.annotation.AsyncConfigurer;
 | 
			
		||||
import org.springframework.scheduling.annotation.EnableAsync;
 | 
			
		||||
 | 
			
		||||
import java.util.Arrays;
 | 
			
		||||
import java.util.concurrent.Executor;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * 异步配置
 | 
			
		||||
 * <p>
 | 
			
		||||
 * 如果未使用虚拟线程则生效
 | 
			
		||||
 *
 | 
			
		||||
 * @author Lion Li
 | 
			
		||||
 */
 | 
			
		||||
@EnableAsync(proxyTargetClass = true)
 | 
			
		||||
@ConditionalOnProperty(prefix = "spring.threads.virtual", name = "enabled", havingValue = "false")
 | 
			
		||||
@AutoConfiguration
 | 
			
		||||
public class AsyncConfig implements AsyncConfigurer {
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user