The javadoc clearly says to use fromValue
.
public static <T> BodyInserter<T,ReactiveHttpOutputMessage> fromValue(T body)
Inserter to write the given value.
Alternatively, consider using the bodyValue(Object) shortcuts on WebClient and ServerResponse.
Type Parameters:
T
- the type of the body
Parameters:
body
- the value to write
Returns:
the inserter to write a single value
Throws:
IllegalArgumentException
- if body is a Publisher or an instance of a type supported by ReactiveAdapterRegistry.getSharedInstance()
, for which fromPublisher(Publisher, Class)
or fromProducer(Object, Class)
should be used.