假设以下情况......
所以:
class MyService{
def myService2
def myService3
public doSomething(){
myService2.doSomething()
myService3.doSomething()
}
}
class MyController{
def myService
def anAction(){
myService.doSomething()
redirect(action:'index')
}
}
我尝试使用 @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
有什么想法可以解决这个问题吗?
谢谢!