spring - Spring Boot Rest 服务应用程序问题与路由逻辑到 mongo db
问题描述
我必须使用 Spring Boot 应用程序创建 api,其中使用 apache camel 和 api 的路由逻辑应该保存到 Mongo db,如果有人创建了这样的应用程序,请提供帮助。
解决方案
你需要使用 apache camel 的 rest 组件
这是一个使用 apache camel 和 springboot的示例应用程序
rest("/users").description("User REST service")
.consumes("application/json")
.produces("application/json")
.get().description("Find all users").outType(User[].class)
.responseMessage().code(200).message("All users successfully returned").endResponseMessage()
.route()
.to("bean:userService?method=findUsers")
.endRest()
在上面的骆驼示例中,我正在为用户创建一个 rest api,它将返回用户列表。
推荐阅读
- c++ - 有没有办法从 std::istream 获取 pcl 点云而不是文件名
- excel - CTRL F 函数并引用找到的单元格整行
- wordpress - 无法获取所选类别 - ACF
- docker - Dockerfile Cassandra - /usr/bin/env: 'python3\r': 没有这样的文件或目录
- php - 输出多个数组php(laravel)
- typescript - 不传递参数的用户定义类型保护
- java - 消除 。来自@符号之前的电子邮件ID
- python - 如何从另一个列表中的字符串创建列表。Python?
- python - 如何通过检查所有元素以及使整个嵌套列表小写来检查字符串是否在嵌套列表中?
- firebase - Firebase Firestore 是否在 React Native Expo 中工作?