I get this error with a gwt (using requestfactory) and spring
My service locatorCode:org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [org.calibra.server.service.AccountService] is defined: expected single bean but found 0: at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:271) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1101) at org.calibra.server.SpringServiceLocator.getInstance(SpringServiceLocator.java:24) at com.google.web.bindery.requestfactory.server.LocatorServiceLayer.createServiceInstance(LocatorServiceLayer.java:56)
My spring serviceCode:public class SpringServiceLocator implements ServiceLocator { @Override public Object getInstance(Class<?> clazz) { ApplicationContext context = WebApplicationContextUtils.getWebApplicationContext( RequestFactoryServlet.getThreadLocalServletContext()); return context.getBean(clazz); } }
Gwt requestContextCode:@Service public class AccountServiceImpl implements AccountService{ @Override public void addNewAccount(Account account) { ... } @Override public List<Account> loadAllAccounts() { ... } }
My web.xmlCode:@Service(value=AccountService.class, locator=SpringServiceLocator.class) public interface AccountRequest extends RequestContext { Request<Void> addNewAccount(AccountProxy account); Request<List<AccountProxy>> loadAllAccounts(); }
my dispatcher-servlet.xmlCode:<context-param> <param-name>contextConfigLocation</param-name> <param-value>/WEB-INF/applicationContext.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> </listener> <servlet> <servlet-name>gwtRequest</servlet-name> <servlet-class>com.google.web.bindery.requestfactory.server.RequestFactoryServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>gwtRequest</servlet-name> <url-pattern>/gwtRequest</url-pattern> </servlet-mapping> <welcome-file-list> <welcome-file>welcomeGWT.html</welcome-file> </welcome-file-list>
I don't understand why i have 0 beanCode:<context:annotation-config /> <context:component-scan base-package="com.calibra" />
Any idea?


Reply With Quote
