google-app-engine-使用Spring连线Google AppEngine的UserServiceFactory
作者:互联网
我想在Spring中连接Google App Engine用户服务,方法是先创建一个UserServiceFactory bean,然后使用它来获取UserService的实例.
<bean id="googleUserServiceFactory"
class="com.google.appengine.api.users.UserServiceFactory"></bean>
<bean id="googleUserService"
class="com.google.appengine.api.users.UserService"
factory-bean="googleUserServiceFactory"
factory-method="getUserService"></bean>
我很确定这是连接从工厂获得的bean的正确方法,但是我收到此错误:
Error creating bean with name ‘googleUserService’ defined in ServletContext resource [/WEB-INF/hardwire-service.xml]: No matching factory method found: factory bean ‘googleUserServiceFactory’; factory method ‘getUserService’
它说找不到工厂方法.工厂方法名称是否可能已更改?
解决方法:
我通过使用MethodInvokingFactoryBean来使其工作.仍然以为我以前做的事情有什么问题让我感到困惑.无论如何:
<bean id="googleUserService"
class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="staticMethod"
value="com.google.appengine.api.users.
UserServiceFactory.getUserService">
</property>
</bean>
标签:google-app-engine,spring 来源: https://codeday.me/bug/20191210/2102184.html