We have a large codebase which uses SpringMVC:
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<version>2.1.6.RELEASE</version>
Now we've faced a challenge to integrate reactive code into on of controllers: the API of external library accepts and provides Publisher<ByteByffer>
for huge binary blob. We decided to use WebFlux for that, and created a method in controller to use with it:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-webflux</artifactId>
<version>2.2.6.RELEASE</version>
</dependency>
and controller:
@RequestMapping("/.../some/path/")
public CompletionStage<ResponseEntity<Flux<DataBuffer>>> handle(RequestEntity<Flux<DataBuffer>> req) {
// processing and returning of blobs
}
It accepts request publisher successfully, but response is generated not correctly: the response is returned as a JSON with field nativeBuffer
with base64 encoded binary data like in this ticket: https://github.com/spring-projects/spring-framework/issues/19714
As I understand from Can I use SpringMvc and webflux together? answer, it's not supposed to use SpringMVC and WebFlux together, but we can't migrate all our 100+ controllers to Flux in one step. Is it possible to move iteratively and migrate them one by one, keeping MVC controllers and Flux in a same project?