HttpInvokerProxyFactoryBean的方式访问项目暴露出的接口首先配置bean
@Bean
public HttpInvokerProxyFactoryBean repositorySky(){
HttpInvokerProxyFactoryBean httpInvokerProxyFactoryBean=new HttpInvokerProxyFactoryBean();
httpInvokerProxyFactoryBean.setServiceUrl(serviceUrl);
httpInvokerProxyFactoryBean.setServiceInterface(ICheckInService.class);
return httpInvokerProxyFactoryBean;
}
在使用的时候注入对应的类则行了 :
@Autowired ICheckInService iCheckInService;
注意:在配置隐式注入的时候不能写在调用接口的类一起,可写在启动类上
本文详细介绍了如何使用HttpInvokerProxyFactoryBean配置bean来访问项目暴露出的接口。通过示例展示了配置方法及注意事项,如设置服务URL和服务接口。
36

被折叠的 条评论
为什么被折叠?



