In a Spring Boot application, how can you specify that a method parameter should be bound to a web request parameter?

  • Using the @RequestParam annotation with the parameter name.
  • By using the @PathVariable annotation with the parameter name.
  • Declaring it as a regular method parameter without any annotations.
  • Using the @ResponseBody annotation with the parameter name.
In a Spring Boot application, you can specify that a method parameter should be bound to a web request parameter by using the @RequestParam annotation followed by the parameter name. This annotation allows you to map a request parameter to a method parameter, providing access to values sent in the HTTP request. The other options are not typically used for binding request parameters.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *