Spring WebClient partial update with @PATCH method when calling another microservice


I have Node.js and Java services where I am trying to use the PATCH method and update the single item in the request body. When I am sending the below request body directly to the Node.js service(http://localhost:8004/products/xxx) it just updates the size and the rest of the items did not change.

    "size": 42,

But when I hit my Java service(http://localhost:8005/products/xxx) which calls the Node.js service it updates the size but the rest of the items are set to null like below. What I am doing wrong?

Updated product {
  title: null,
  desc: null,
  img: null,
  categories: null,
  size: '42',
  price: null


public Mono<Products> updateProduct(String id, Products editProduct){
    return  webClient
            .uri("/products/{id}", id)
            .body(Mono.just(editProduct), Products.class)

@ResponseStatus(code = HttpStatus.OK)
public Mono<Products> updateProduct(@PathVariable("id") String id, @Validated @RequestBody Products editProduct){
    return  basketService.updateProduct(id, editProduct);


    router.patch('/:id', async (req, res) => {
        const productId = req.params.id
        const updates = req.body
        console.log("Updated product", updates)
        const result = await Product.findByIdAndUpdate(productId, updates)
      }catch(err) {


I think you can annotate your Products class to let Jackson know that it should not serialize null values:

class Products {


You can also do that with a configuration property in Spring Boot globally, but this would affect also JSON payloads server by your application.

Answered By – Brian Clozel

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published