0
在我的Grails 3.1.14我的应用程序需要添加一个bean,在异步方法调用的回调创建:添加Spring bean的异步
Vertx.clusteredVertx([:]){ AsyncResult<Vertx> res ->
if(res.succeeded()){
Vertx vertx = res.result() // << this should be injected into the appContext
}
}
,这样的实例可以被装配成跨越其他文物整个应用。
实现此目的的正确方法是什么?
我可以用StaticApplicationContext
吗?或者它会破坏什么?
另一种方法是使用“容器bean”并在异步方法完成时设置它,但它有点难看。