spring - 如何使用带有 @PathVariable 的 Spring RemoteExporter
问题描述
我有一个(RPC)服务,我正在使用RemoteExporter
如下所示:
@Service
public class FooService {
// some operations here
}
@Configuration
public class RpcConfiguration {
@Bean("/foo.rpc")
RemoteExporter fooService(FooService foo) {
// create and return the exporter here
}
}
一切正常。现在我想在路径下公开服务/foo/{fooId}/bar.rpc
(而不是/foo.rpc
)。我认为RemoteExporter
不理解路径变量(fooId
)很好,只要我可以在路径下公开它/foo/*/bar.rpc
(我将自己在导出器中提取路径变量)。
有没有办法在 Spring (Boot) 中做到这一点,最好没有 XML 的东西?谢谢。
解决方案
事实证明它比我想象的要聪明得多。只需使用问题中给出的模式作为 bean 名称!♂️</p>
推荐阅读
- javascript - 如何使用 react-native-render-html 获取特定类
- node.js - 读取文本文件并获取行之间的特定文本并将其保存在节点 js 的 csv 文件中?
- spring-boot - 带有 Spring Boot 的 Web 套接字通过 http 但不是 https
- macos - 如何在 Mac 主目录中创建 .zshrc?
- angular - 如何让 matIconRegistry.addSvgIcon 找到正确的路径
- openstack - 如何在不同的服务器上安装 Ceilometer 和 Gnocchi?
- javascript - 我在 html 中创建了一个展开按钮,它更改图标并显示内容(并反转它)但媒体查询第二次(不是第一次)
- python - 不需要的图像形状 cv2
- javascript - 如何按样式制作条件?
- python - 从给定的掩码逼近一个四边形