GH-2464: WebFlux: Get rid of Mono.block() (#2465)

* GH-2464: WebFlux: Get rid of Mono.block()

Fixes https://github.com/spring-projects/spring-integration/issues/2464

The `WebFluxInboundEndpoint` resolves a `Principal` via `Mono.block()`
operation.
This is prohibited situation in the non-blocking thread, like Reactor
Netty

* Defer `Mono<Principal>` resolution to the message header via
deferring the whole `Message` creating via `flatMap()` operation on the
main `doHandle()` `Mono`

**Cherry-pick to 5.0.x**

* * Fix Checkstyle for the Reactive Spring Security testing utils static imports
* Add `defaultIfEmpty()`, when `exchange.getPrincipal()` is an empty `Mono`
This commit is contained in:
Artem Bilan
2018-06-11 16:34:04 -04:00
committed by Gary Russell
parent 18c206768a
commit 125cc861d4
3 changed files with 64 additions and 19 deletions

View File

@@ -104,7 +104,9 @@
org.springframework.test.web.servlet.request.MockMvcRequestBuilders.*,
org.springframework.test.web.servlet.result.MockMvcResultMatchers.*,
org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors.*,
org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.*" />
org.springframework.security.test.web.servlet.setup.SecurityMockMvcConfigurers.*,
org.springframework.web.reactive.function.client.ExchangeFilterFunctions.*,
org.springframework.web.reactive.function.client.ExchangeFilterFunctions.Credentials.*" />
</module>
<module name="IllegalImport" />
<module name="RedundantImport" />