我有一个目标
class Employee {
private String salary;
private String empId;
private String departmentId;
private String status;
} 还有一个返回Flux的方法,文档是org.bson.Document类型的,例如
[
{
"empId": "B123",
"salary": "1000",
"departmentId": "winna",
"status": "START"
},
{
"empId": "A123",
"salary": "2000",
"departmentId": "dinna",
"status": "COMPLETED"
}
] 如何在JAVA中将Flux转换为Flux或List?
发布于 2021-12-16 18:14:52
这是我用的。它运转得很好。studentService.getAll()使用我可以转换成Flux<String>的映射返回Flux<Student>。你需要考虑@Ikatiforis的答案。

在你的情况下,下面的方法应该有效
documentFlux.map(d-> {
Employee e = new Employee();
//set values
return e;
});https://stackoverflow.com/questions/70302120
复制相似问题