menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Programming News

>

How to rea...
source image

Dev

2M

read

427

img
dot

Image Credit: Dev

How to read Query Param in Spring Boot

  • Create a Spring Boot project with the dependency 'spring-boot-starter-web' added in the pom.xml file.
  • In the GreetingController class, a REST endpoint '/greet' is defined with two RequestParam annotations for 'name' and 'title'.
  • The 'name' parameter is marked as required, while the 'title' parameter is optional with a default value of 'User'.
  • When hitting the endpoint 'http://localhost:8080/greet?name=John&title=Mr', the output will be 'Hello Mr John!'.

Read Full Article

like

25 Likes

For uninterrupted reading, download the app