我对在变量上使用 Inject 有点迷茫。
我得到了这段代码:
private XXServiceAsync xxServiceAsync;
@Inject
protected IndexViewImpl(EventBus eventBus, XXServiceAsync tableManagementServiceAsync) {
super(eventBus, mapper);
this.xxServiceAsync = xxServiceAsync;
initializeWidgets();
}
使用这段代码,我可以在课堂上的任何需要的地方调用我的 RPC 服务(点击...)我想通过直接在变量中注入来清除代码;这样做 :
@Inject
private XXServiceAsync xxServiceAsync;
protected IndexViewImpl(EventBus eventBus) {
super(eventBus, mapper);
initializeWidgets();
}
这始终将服务保持为 NULL。难道我做错了什么 ?rpc 服务的 GIN 魔法是否意味着要以其他方式完成?
谢谢!