美文网首页
bean的自动装载,实现多接口调用

bean的自动装载,实现多接口调用

作者: jeffDeng | 来源:发表于2017-04-01 18:10 被阅读18次

1.一个统一的接口实现类 ,需传入请求接口serviceId,与请求参数params
commonService.invoke(serviceId,params)
2.根据请求serviceId在redis中获取到相关的接口信息
3.获取到具体的接口信息后,通过service工厂(InterfaceTargetService)按数据源类型分类请求 ——每个接口都有自己的实现类impl,
此方法的实现方法是,通过spring的自动装载bean,获取到bean的实例(每个接口的实现类)


<bean id="interfaceTargetServiceFactory"
class="com.iboxpay.remote.service.impl.InterfaceTargetServiceFactoryImpl">
<property name="serviceMap">
<map>
<entry key="dataCenter" value="dataCenterService" />
<entry key="tiNet" value="tiNetService" />
<entry key="riskCon" value="riskConService"></entry>
<entry key="iboxpayWx" value="iboxpayWxService"></entry>
</map>
</property>
</bean>
4.传入参数,调用外部接口

相关文章

网友评论

      本文标题:bean的自动装载,实现多接口调用

      本文链接:https://www.haomeiwen.com/subject/hurobttx.html