Skip to content

combination of result and single/multi for spring webflux #232

Answered by hauner
astmuc asked this question in Q&A
Discussion options

You must be logged in to vote

I understand that this will not work because the eTag() depends on the result of SomeBean:

return ResponseEntity.ok ()
     .eTag("foo")
     .body (result of SomeBean);

which is a ResponseEntity<Mono<SomeBean>>

and you would like to do something like this:

return someBean.getResult()
       .map(r -> ResponseEntity.ok()
       .eTag(r.getEtag())
       .body(r));

which is a Mono<ResponseEntity<SomeBean>>

There is currently no official feature to switch the order of Mono/ResponseEntity.

Anyway, there are two workarounds

Object workaround

  paths:
    /some-bean-endpoint:
      get:
        types:
          - type: SomeBean => java.lang.Object
        result: plain

this uses official featu…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@astmuc
Comment options

Answer selected by astmuc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants