我正在尝试从我的 EntryPoint 类调用 RemoteService。 但是,我在 GWT.create() 中收到错误。我正在传递我的服务的客户端接口(interface)。我收到错误消息,它必须是一个类。
19:私有(private)LoginServiceAsync loginServiceAsync = GWT.create(LoginService.class);
[错误]第 19 行:重新绑定(bind)结果“com.example.client.LoginService”必须是一个类
这是我在客户端文件夹中的 LoginService 代码:
package com.example.client;
import com.google.gwt.user.client.rpc.RemoteServiceRelativePath;
@RemoteServiceRelativePath("LoginService")
public interface LoginService {
boolean signUpUser(String name, String email, String password);
}
谁能告诉我我做错了什么?谢谢,提前。
最佳答案
GWT.create(MyClass.class)
首先查找替换规则或生成规则。如果 GWT 没有找到规则,它将执行 new MyClass()
。
由于您没有扩展RemoteService
,GWT 找不到generate-with-rule 并尝试new
。
这就是您收到此错误的原因。
关于java - GWT.create(MyClass.class) 给出 MyClass 必须是一个类的错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57194824/