How to get String from Mono in reactive java

前端 未结 6 1866
鱼传尺愫
鱼传尺愫 2020-12-09 04:01

I have a method which accepts Mono as a param. All I want is to get the actual String from it. Googled but didn\'t find answer except calling block() over Mono object but it

6条回答
  •  北海茫月
    2020-12-09 04:29

    Finally what worked for me is calling flatMap method like below:

    public void getValue(Mono monoString)
    {
       monoString.flatMap(this::print);
    }
    

提交回复
热议问题