@@ -0,0 +1,708 @@
+package com.hzh.web.controller;%0A%0Aimport org.springframework.web.bind.annotation.RequestMapping;%0Aimport org.springframework.web.bind.annotation.RestController;%0A%0Aimport java.util.concurrent.CompletableFuture;%0A%0A@RestController%0Apublic class BackgroundTaskController %7B%0A%0A    @RequestMapping(%22merge%22)%0A    public String mergeProduct() %7B%0A        CompletableFuture.runAsync(()-%3E%7B%0A            System.out.println(%22start to do something for a long time%22);%0A            try %7B%0A                Thread.sleep(10000);%0A            %7D catch (InterruptedException e) %7B%0A                e.printStackTrace();%0A            %7D%0A            System.out.println(%22Done something for a long time%22);%0A        %7D);%0A        return %22success%22;%0A    %7D%0A%7D%0A

添加background task controller