Spring Webflux控制器返回类型

时间:2019-03-22 11:24:29

标签: spring spring-boot controller reactive-programming spring-webflux

在基于Webflux注释的Controller中,每种返回类型的优缺点是什么?

关于性能,框架的开销,流媒体Cababilites等...

普通类型

@GetMapping
public Something method()
{
     // ...
}

反应类型

@GetMapping
// public Flux<Something> method()
public Mono<Something> method()
{
     // ...
}

具有响应类型的ResponseEntity

@GetMapping
public ResponseEntity<Mono<Something>> method()
{
     // ...
}

具有ResponseEntity的反应类型

@GetMapping
public Mono<ResponseEntity<Something>> method()
{
     // ...
}

0 个答案:

没有答案