概念
同步:就是在发出一个调用时,在没有得到结果之前,该调用就不返回(实时处理)
异步:调用在发出之后,这个调用就直接返回了,没有返回结果(分时处理)
代码
在执行异步的方法上添加@Async
            
            
              less
              
              
            
          
          @Slf4j
@Transactional
@Service
public class ArticleFreemarkerServiceImpl implements ArticleFreemarkerService  {
    @Async
    @Override
    public void buildArticleToMinIO(ApArticle apArticle, String content) {
    
            xxxxxx     
            
            }
    }
        引导类使用@EnableAsync开启异步调用
            
            
              less
              
              
            
          
          @SpringBootApplication
@EnableAsync
public class ArticleApplication {
    public static void main(String[] args) {
        SpringApplication.run(ArticleApplication.class,args);
    }
}