feat: 使用 jdk instanceof 新特性
This commit is contained in:
@@ -23,15 +23,13 @@ public class YudaoAsyncAutoConfiguration {
|
||||
@Override
|
||||
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
||||
// 处理 ThreadPoolTaskExecutor
|
||||
if (bean instanceof ThreadPoolTaskExecutor) {
|
||||
ThreadPoolTaskExecutor executor = (ThreadPoolTaskExecutor) bean;
|
||||
if (bean instanceof ThreadPoolTaskExecutor executor) {
|
||||
executor.setTaskDecorator(TtlRunnable::get);
|
||||
return executor;
|
||||
}
|
||||
// 处理 SimpleAsyncTaskExecutor
|
||||
// 参考 https://t.zsxq.com/CBoks 增加
|
||||
if (bean instanceof SimpleAsyncTaskExecutor) {
|
||||
SimpleAsyncTaskExecutor executor = (SimpleAsyncTaskExecutor) bean;
|
||||
if (bean instanceof SimpleAsyncTaskExecutor executor) {
|
||||
executor.setTaskDecorator(TtlRunnable::get);
|
||||
return executor;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user