我正在尝试向 Spring Web 应用程序公开远程接口,但我遇到了问题,总是得到 404。下面的设置有什么问题?
Grails :
服务 - 包 mypackage
class RemoteUserService implements RemoteUserServiceInterface {
static expose = ['httpinvoker']
User findUser(String userId) {
return User.findByUserId(userId);
}
}
src/groovy/mypackage
class RemoteUserService implements RemoteUserServiceInterface {
static expose = ['httpinvoker']
User findUser(String userId) {
return User.findByUserId(userId);
}
}
春天:
我的包裹
public class MyController extends AbstractController {
RemoteUserServiceInterface remoteUserService
}
应用上下文
<bean id="viewController" class="mypackage.MyController">
<property name="remoteUserService" ref="remoteUserService"/>
</bean>
<bean id="remoteUserService" class="org.springframework.remoting.httpinvoker.HttpInvokerProxyFactoryBean">
<property name="serviceUrl" value="http://localhost:8080/grails-app-name/httpinvoker/RemoteUserService"/>
<property name="serviceInterface" value="mypackage.RemoteUserServiceInterface"/>
</bean>