【发布时间】:2018-11-13 14:46:22
【问题描述】:
我们有很多小型 Spring Boot 应用程序,它们是迁移到 Micronaut 的潜在候选者。他们中的大多数使用 Springs HTTP Invoker 相互通信。
这是一个将执行远程调用的客户端服务 bean 的示例。
@Bean
public HttpInvokerProxyFactoryBean brokerService() {
HttpInvokerProxyFactoryBean invoker = buildHttpInvokerProxyFactoryBean();
invoker.setServiceUrl(remotingBaseUrl + BrokerService.URI);
invoker.setServiceInterface(BrokerService.class);
return invoker;
}
BrokerService 看起来像像这样
public interface BrokerService {
/**
* Creates a new offer of the given data.
*
* @param ctx All relevant data to create a new offer.
* @return the newly created offer instance.
*/
Offer createOffer(OfferCreationContext ctx);
}
Micronaut 中是否有使用 Spring HTTP Invoker 的方法?
【问题讨论】:
-
你能显示 BrokerService 的代码吗?
-
@JamesKleeh 感谢您的回复。您究竟想从 BrokerService 中看到什么?接口够用还是想看服务端实现?
-
我认为没有什么可以阻止您在 Micronaut 中使用 spring http 调用程序,但是您可以使用 micronaut http 客户端实现相同的目标,而无需向 spring http 调用程序添加依赖项。如果您要使用另一个接口扩展该接口并使用 @Client 对其进行注释并扩展方法以添加 @Get/@Put/etc 注释,我相信它应该可以工作
标签: micronaut