我有一个 maven+spring+gwt 项目,我想在其中使用请求工厂。我只是不知道为什么我会得到这个例外。
请求工厂:
public interface StarRequestFactory extends RequestFactory {
@Service(value = RaduService.class, locator = GWTServiceLocator.class)
public interface RaduRequestContext extends RequestContext {
Request<Void> save( );
}
RaduRequestContext raduRequestcontext();
}
服务 :
public class RaduService {
public void save(){
System.out.println("You have saved.");
}
}
定位器:
public class GWTServiceLocator implements ServiceLocator,
ApplicationContextAware {
private ApplicationContext context;
@Override
public Object getInstance(Class<?> clazz) {
return context.getBean(clazz);
}
@Override
public void setApplicationContext(ApplicationContext context)
throws BeansException {
this.context = context;
}
}
在我的入口点类中,我提出了请求:
requestFactory.raduRequestcontext().save().fire(new Receiver<Void>() {
@Override
public void onSuccess(Void response) {
System.out.println("Success");
}
});
在此请求中,我收到以下错误:
[错误] Iul 25, 2012 3:35:36 PM com.google.web.bindery.requestfactory.server.RequestFactoryServlet doPost [错误] 严重:意外错误 [错误] org.springframework.beans.factory.NoSuchBeanDefinitionException:没有唯一的 bean [com.base.star.shared.services.StarRequestFactory$RaduRequestContext] 类型的定义:预期单个 bean,但在 org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:269 找到 0:[错误] ) [错误] 在 org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1083) [错误] 在 com.base.star.server.integration.GWTServiceLocator.getInstance(GWTServiceLocator.java:25) [错误]在 com.base.star.server.integration.GWTServiceLayerDecorator.createServiceInstance(GWTServiceLayerDecorator.java:43) [错误] 在太阳。reflect.NativeMethodAccessorImpl.invoke0(Native Method) [ERROR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [ERROR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [ERROR] at java .lang.reflect.Method.invoke(Method.java:601) [ERROR] at com.google.web.bindery.requestfactory.server.ServiceLayerCache.getOrCache(ServiceLayerCache.java:233) [ERROR] at com.google.web .bindery.requestfactory.server.ServiceLayerCache.createServiceInstance(ServiceLayerCache.java:117) [错误] 在 com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.processInvocationMessages(SimpleRequestProcessor.java:451) [错误] 在 com.google .web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:225) [错误] 在 com.google.web。bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:127) .................... ………………………………………………………………………………
有谁知道这是怎么回事?
如果需要,我可以发布 pom。