通过延期绑定产生的内分泌注射液 [英] Gin Injection Inside Class Generated By Deferred Binding

查看:129
本文介绍了通过延期绑定产生的内分泌注射液的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是问题,我有代码由GWT中的Deferred Binding生成,我想在此代码中使用Gin Injection。

Here is the problem, I have code being generated by Deferred Binding in GWT, and I would like to use Gin Injection inside of this code.

最初,我尝试在生成的类中放置一个具有@Inject注释的私有构造函数,但是GWT抱怨它没有公共noargs构造函数。在任何情况下,我也有错误,我试图注入一些抽象而没有绑定,并且觉得我不可能绑定它,因为我没有在运行时可用的类型文字。

Initially, I attempted to put a private constructor with an @Inject annotation in the generated class, but GWT complained that it did not have a public noargs constructor. In any case, I also got errors regarding my attempts to inject something abstract without bindings, and feel like I couldn't possibly bind it since I don't have the type literal available at runtime.

我的下一次尝试是在类本身内生成一个Ginjector和Gin模块,但是在Ginjector注释无法找到Gin模块时出现错误,这对我来说很混乱。此外,这将把注入隔离到可以产生的内容,而不是外部的依赖。

My next attempt was to generate a Ginjector and Gin module inside the class itself, but got errors regarding the inability to find the Gin module for the Ginjector annotation, which was confusing to me. Besides, this would have isolated the injection to what could be generated, and not the external dependencies.

无论如何,有没有人尝试过这样的事情?有人有任何建议吗?

In any case, has anybody attempted such a thing? Does anybody have any advice?

推荐答案

我也是这样做的。看起来这是一个计划的功能,这是在中继线中实现,但直到稍后才会可用。

I'm trying to do this too. It looks like it's a planned feature that's been implemented in the trunk but won't be available until later.

这篇关于通过延期绑定产生的内分泌注射液的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆