使用Spring应用程序中的java本机ExecutirService运行线程

使用Spring应用程序中的java本机ExecutirService运行线程,java,spring,multithreading,Java,Spring,Multithreading,我用vaadingui开发了springboot应用程序。此应用程序使用“后台服务器”逻辑,该逻辑封装在单独的jar文件中(包含在spring boot应用程序中)。我使用后台服务器的外观在spring boot应用程序开始时启动它。所以,这是春季服务 @org.springframework.stereotype.Service public class FacadeService { @Autowired private TaskExecutor taskExecutor;

我用vaadingui开发了springboot应用程序。此应用程序使用“后台服务器”逻辑,该逻辑封装在单独的jar文件中(包含在spring boot应用程序中)。我使用后台服务器的外观在spring boot应用程序开始时启动它。所以,这是春季服务

@org.springframework.stereotype.Service
public class FacadeService {
    @Autowired
    private TaskExecutor taskExecutor;

    public void startService() throws IOException {
        BackgroundServerFacade facade = new BackgroundServerFacade ();// some logic of "background server" from included jar file
        taskExecutor.execute(facade);
    }
}
它是在AppRunner的帮助下开始的

@Component
public class FacadeThreadAppRunner implements ApplicationRunner {
    @Autowired
    private FacadeService service;

    @Override
    public void run(ApplicationArguments args) throws Exception {
        service.facadeTestInit();
    }
}
问题在于,我的类BackgroundServerFacade运行本机java ExecutorService,该服务在运行时提交不同的线程,并从jar文件启动本机java线程

public class BackgroundServerFacade implements Runnable {
      @Override
      public void run() {
        ExecutorService newSingleThreadExecutor = Executors.newSingleThreadExecutor();

        UpdateCenterImpl updateCenterImpl = new UpdateCenterImpl(newSingleThreadExecutor);
        updateCenterThread = new Thread(updateCenterImpl);
        updateCenterThread.start();
      }
}
现在这个嵌套的本机java线程和ExecutorService无法工作。我认为这与rool有关,spring应用程序中的线程必须从spring执行器运行。我不能将BackgroundServerFacade重构为spring执行器,因为它是一个单独的jar,有自己的逻辑(非spring,只有java逻辑)。。。如何使用spring应用程序中包含的jar文件中的本机java多线程