- Hands-On Spring Security 5 for Reactive Applications
- Tomcy John
- 152字
- 2021-07-23 18:59:14
The Mono reactive type
A Reactive Streams Publisher with basic Rx operators that completes successfully by emitting an element, or with an error.
– Mono JavaDoc
Mono<T> is a Publisher<T> that supports 0..1 elements.
The definition of Mono is as follows:
public abstract class Mono<T>
extends Object
implements Publisher<T>
As detailed in the documentation, the following figure shows the workings of Mono:
Figure 08: Working of Mono
Mono<Void> should be used for a Publisher that completes with no value. The documentation explains each method and how it works using a marble diagram, which is self-explanatory. Again, this type is also supported by Spring 5 and Spring Security.
JavaDoc for Mono contains more information: https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html.
Let's have a look at some examples:
- Creating empty Mono:
Mono<String> emptyMono = Mono.empty();
- Creating Mono with a value in it:
Mono<String> itemMono = Mono.just("Spring Security Reactive”);
- Creating Mono that emits an exception:
Mono.error(new CreatedException());
推薦閱讀
- 黑客大曝光:無線網(wǎng)絡(luò)安全(原書第3版)
- 計(jì)算機(jī)病毒分析與防范大全(第3版)
- 計(jì)算機(jī)病毒原理與防范(第2版)
- 反黑命令與攻防從新手到高手(微課超值版)
- 安全技術(shù)運(yùn)營:方法與實(shí)踐
- 云原生安全與DevOps保障
- 信息安全案例教程:技術(shù)與應(yīng)用(第2版)
- Instant Java Password and Authentication Security
- 學(xué)電腦安全與病毒防范
- 信息技術(shù)基礎(chǔ):提高篇·實(shí)驗(yàn)與習(xí)題
- VMware vCloud Security
- 網(wǎng)絡(luò)空間安全實(shí)戰(zhàn)基礎(chǔ)
- Kali Linux無線網(wǎng)絡(luò)滲透測(cè)試詳解
- Manga Studio 5 Beginner's Guide
- 黑客攻防從入門到精通:實(shí)戰(zhàn)篇(第2版)