我有一个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");
}
});
在此请求中,我收到以下错误:
[ERROR] Iul 25,2012 3:35:36 PM com.google.web.bindery.requestfactory.server.RequestFactoryServlet doPost [ERROR]严重:意外错误 [错误] org.springframework.beans.factory.NoSuchBeanDefinitionException:没有定义[com.base.star.shared.services.StarRequestFactory $ RaduRequestContext]类型的唯一bean:期望的单个bean但找到0: org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean的[错误](DefaultListableBeanFactory.java:269) [错误]在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) [错误]在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法) [错误]在sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [错误]在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke中的[错误](Method.java:601) [错误]在com.google.web.bindery.requestfactory.server.ServiceLayerCache.getOrCache(ServiceLayerCache.java:233) [错误] 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 [SimpleRquest] [错误]在com.google.web.bindery.requestfactory.server.SimpleRequestProcessor.process(SimpleRequestProcessor.java:127) .................................................. ........
有谁知道这是关于什么的?
如果需要,我可以发布pom。
答案 0 :(得分:1)
似乎是一个Spring错误:
您是否使用RaduService
注释了@Service
类,或者将其作为bean在ApplicationContext.xml文件中定义?