我有一个实现 EmailService 的类 EmailServiceImpl 和另一个实现 ReportService 的类 ReportServiceImpl。这两个接口(interface)都带有@EnableAsync注解,因此存在带有@Async注解的方法。
我正在使用默认的 spring 任务执行器。
我无法在 ReportService 内自动连接 EmailService。
最佳答案
它现在可以工作了,我使用 applicationcontext.getBean("beanName") 方法来获取 bean 而不是 @Autowired。
关于java - 如何在另一个具有异步方法的类中 Autowiring 具有异步方法的类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37605653/