mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
日志记录优化:全服务支持异步方法、异步配置从job移到web
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@
|
||||
* 6. MQ:在 Producer 发送消息时,Header 带上 organ-id 组织编号;在 Consumer 消费消息时,将 Header 的 organ-id 组织编号,添加到组织上下文。
|
||||
* 7. Async:异步需要保证 ThreadLocal 的传递性,通过使用阿里开源的 TransmittableThreadLocal 实现。相关的改造点,可见:
|
||||
* 1)Spring Async:
|
||||
* {@link com.cf.imes.framework.quartz.config.ChenfengAsyncAutoConfiguration#threadPoolTaskExecutorBeanPostProcessor()}
|
||||
* {@link com.cf.imes.framework.quartz.config.ChenfengAsyncThreadAutoConfiguration#threadPoolTaskExecutorBeanPostProcessor()}
|
||||
* 2)Spring Security:
|
||||
* TransmittableThreadLocalSecurityContextHolderStrategy
|
||||
* 和 chenfengSecurityAutoConfiguration#securityContextHolderMethodInvokingFactoryBean() 方法
|
||||
|
||||
+2
-5
@@ -5,16 +5,13 @@ import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
/**
|
||||
* 异步任务 Configuration
|
||||
* 异步线程 Configuration
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@EnableAsync
|
||||
public class ChenfengAsyncAutoConfiguration {
|
||||
public class ChenfengAsyncThreadAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
public BeanPostProcessor threadPoolTaskExecutorBeanPostProcessor() {
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
com.cf.imes.framework.quartz.config.ChenfengXxlJobAutoConfiguration
|
||||
com.cf.imes.framework.quartz.config.ChenfengAsyncAutoConfiguration
|
||||
com.cf.imes.framework.quartz.config.ChenfengAsyncThreadAutoConfiguration
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
package com.cf.imes.framework.async;
|
||||
|
||||
import org.springframework.boot.autoconfigure.AutoConfiguration;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
|
||||
/**
|
||||
* 异步任务 Configuration
|
||||
*/
|
||||
@AutoConfiguration
|
||||
@EnableAsync
|
||||
public class ChenfengAsyncAutoConfiguration {
|
||||
}
|
||||
+1
@@ -3,3 +3,4 @@ com.cf.imes.framework.jackson.config.ChenfengJacksonAutoConfiguration
|
||||
com.cf.imes.framework.swagger.config.ChenfengSwaggerAutoConfiguration
|
||||
com.cf.imes.framework.web.config.ChenfengWebAutoConfiguration
|
||||
com.cf.imes.framework.apilog.config.ChenfengApiLogRpcAutoConfiguration
|
||||
com.cf.imes.framework.async.ChenfengAsyncAutoConfiguration
|
||||
|
||||
Reference in New Issue
Block a user