Grails 2.4.3-异步编程@DelegateAsync

Grails 2.4.3-异步编程@DelegateAsync,grails,asynchronous,Grails,Asynchronous,假设以下情况 我必须执行一个耗时(约1小时)的过程 我不希望我的应用程序的用户等到它结束 此流程的业务逻辑封装在多个服务中 因此: 我希望对我的服务的调用是异步的 我尝试使用@DelegateAsync创建Grails文档所示的异步服务 class AsyncMyService { @DelegateAsync MyService myService } class MyController{ def asyncMyService def anActi

假设以下情况

  • 我必须执行一个耗时(约1小时)的过程 我不希望我的应用程序的用户等到它结束
  • 此流程的业务逻辑封装在多个服务中
因此:

  • 我希望对我的服务的调用是异步的
我尝试使用@DelegateAsync创建Grails文档所示的异步服务

class AsyncMyService {

    @DelegateAsync MyService myService

}

 class MyController{

    def asyncMyService

    def anAction(){
       asyncMyService.doSomething()
        .onComplete { List results ->
           println "completed!"             
        }
       redirect(action:'index')
    }
}
但在编译应用程序时出现以下错误:

Caused by ConversionNotSupportedException: Failed to convert property value of type 
'MyService2$$EnhancerBySpringCGLIB$$f08a1b38' to equired type 'grails.async.Promise' 
for property 'myService2'; nested exception is java.lang.IllegalStateException: Cannot 
convert value of type [MyService2$$EnhancerBySpringCGLIB$$f08a1b38] to required type 
[grails.async.Promise] for property 'myService2': no matching editors or conversion 
strategy found
有什么办法解决这个问题吗


谢谢

嗯。。。grails版本?Java版本?这些可能会帮助您获得答案。Java 1.7。这是因为myService2和myService3不是异步的吗?可能是,当DelegateAsync转换尝试创建myService的异步版本时,由于这些其他依赖项而失败。尝试暂时删除这些服务,看看它是否按预期工作。如果是这样的话,您可能只需要创建myService2和myService3的异步版本。@BryanGCampbell我会试试,然后告诉您结果。。。grails版本?Java版本?这些可能会帮助您获得答案。Java 1.7。这是因为myService2和myService3不是异步的吗?可能是,当DelegateAsync转换尝试创建myService的异步版本时,由于这些其他依赖项而失败。尝试暂时删除这些服务,看看它是否按预期工作。如果是这样,您可能只需要创建myService2和myService3的异步版本。@BryanGCampbell我会尝试一下,并告诉您结果
Caused by ConversionNotSupportedException: Failed to convert property value of type 
'MyService2$$EnhancerBySpringCGLIB$$f08a1b38' to equired type 'grails.async.Promise' 
for property 'myService2'; nested exception is java.lang.IllegalStateException: Cannot 
convert value of type [MyService2$$EnhancerBySpringCGLIB$$f08a1b38] to required type 
[grails.async.Promise] for property 'myService2': no matching editors or conversion 
strategy found