Home > Net >  How to Initialize an empty Mono Class object in reactive programming?
How to Initialize an empty Mono Class object in reactive programming?

Time:10-31

I am learning reactive and i wanted to know how to initialize an mono object like in java we used to do.User usr=new User(). how to create a Mono object of this similar class

CodePudding user response:

The simplest way of doing this is with the Mono#just(T data) method:

Mono<User> user = Mono.just(new User());

In this case, we have a static stream of one User.

CodePudding user response:

There are different ways you can create an object. Checkout this link for better understanding https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Mono.html Here you can just use the Mono.just(new User());

  • Related