1

我的许多服务只是暴露的 DAO。所以我为这些服务创建了一个接口:

public interface DAORequestContext<T extends SRSProxyBase> extends RequestContext {
    Request<T> find(Long id);

    Request<T> load(Long id);

    Request<T> save(T id);
}

但是,当扩展此接口时(在我的 RequestFactory 中没有注释):

public interface SafeRideRequestFactory extends RequestFactory {
    public UserService userService();

    @Service(value = UserDAO.class, locator = DAOServiceLocator.class)
    interface UserService extends DAORequestContext<SRSUserProxy> { }
}

我得到运行时异常:

[ERROR] org.saferide.shared.service.DAORequestContext has no mapping to a domain type (e.g. @ProxyFor or @Service)
[ERROR] The type org.saferide.shared.service.DAORequestContext must be annotated with a @Service or @ServiceName annotation
[ERROR] The RequestContext type org.saferide.shared.service.DAORequestContext did not pass validation
[ERROR] Unexpected error
com.google.web.bindery.requestfactory.server.UnexpectedException: The RequestContext type org.saferide.shared.service.DAORequestContext did not pass validation

是否只允许 RequestContext 的直接后代?有人遇到过这个吗?

4

1 回答 1

1

请参阅http://code.google.com/p/google-web-toolkit/issues/detail?id=5807和相关的http://code.google.com/p/google-web-toolkit/issues/detail? id=6234http://code.google.com/p/google-web-toolkit/issues/detail?id=6035

这实际上取决于您使用的 GWT 版本,并且仍在改进中。您最好在发布时使用 GWT 2.4(此外,“验证”将在编译时而不是运行时完成)

于 2011-08-28T10:33:02.840 回答