problem description
how does the webflux, of spring5 return custom json data?
related codes
/ / Please paste the code text below (do not replace the code with pictures)
when webflux is not available on the server, my service is written like this
public Map<String, Object> registerService(User user) {
Map<String, Object> map = new HashMap<>(8);
map.put("status":1);
userRepository.save(user);
return map;
now when you change it to webflux, you won"t get the same result as above
public Mono<Map<String, Object>> registerService(User user) {
Map<String, Object> map = new HashMap<>(8);
map.put("status", 1);
userRepository.save(user);
return Mono.just(map);
}
what result do you expect? What is the error message actually seen?
now the return result of webflux is {"status": 1}, and the returned json data is that I want me, but there is no user, inserted in mongo. I just want to return my custom json data as above, and insert the data
at the same time.