package Ġm code . product . command Ċ Ċ import Ġm code . product . services . Product Service Ċ import Ġorg . springframework . http . HttpStatus Ċ import Ġorg . springframework . http . Response Entity . created Ċ import Ġorg . springframework . stereotype . Component Ċ import Ġorg . springframework . web . reactive . function . Body Inser ters . from Object Ċ import Ġorg . springframework . web . reactive . function . server . Server Request Ċ import Ġorg . springframework . web . reactive . function . server . Server Response Ċ import Ġorg . springframework . web . reactive . function . server . body To Mono Ċ import Ġjava . net . URI ĊĊ Ċ @ Component Ċ class ĠProduct Handler ( val Ġproduct Service : ĠProduct Service ) Ġ{ ĊĠĠĠ Ġfun Ġget ( request : ĠServer Request ) Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġproduct Service ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. get Product ( request . path Variable (" id "). toInt ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. flatMap Ġ{ Ġp Ġ-> ĠServer Response . ok (). body ( from Object ( p )) Ġ} ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. switch If Empty ( Server Response . status ( HttpStatus . NOT _ FOUND ). build ()) ĊĊĠĠĠ Ġfun Ġcreate ( request : ĠServer Request ) Ġ= ĊĠĠĠĠĠĠĠĠĠĠĠ Ġproduct Service . create Product ( request . body To Mono ()) ĊĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠĠ Ġ. flatMap Ġ{ ĠServer Response . created ( URI . create ("/ customer /${ it . id } ")). build () Ġ} Ċ Ċ }