@Configuration public class WaybillQueryFacadeConfiguration { @Autowired private WaybillQueryFacade waybillQueryFacade; @Bean public boolean waybillQueryFacade() throws Exception { ServiceFactory.addService("http://service.ymm.com/trade/om/waybillQueryFacade_1.0.0", WaybillQueryFacade.class, waybillQueryFacade); ServiceFactory.publishService("http://service.ymm.com/trade/om/waybillQueryFacade_1.0.0"); return true; } }
其实这么写的目的,我猜测更多是利用spring的项目启动自动扫描,自动执行@Bean,其实RPC框架本身并不利用spring。