Lab
-
Replace the
@Controllerannotation forTestControllerwith@RestController, and remove@ResponseBodyfrom thepingmethod. -
In
TestController, create a method namedechothat's mapped to"echo"using the POST method. It should take aStringparameter annotated with@RequestBody. It should return the parameter passed. -
Test this endpoint using Postman. Add a new request tab. Select POST as the method and
http://localhost:8080/echoas the URL. Under the request, click Body, and choose raw. Enter a message like "Hello, REST!" and send the request.