Which of the following annotations is used to map a web request to a specific handler method?
- @RequestMapping
- @ResponseBody
- @PostMapping
- @Autowired
The @RequestMapping annotation is used to map a web request to a specific handler method in a Spring Boot controller. It allows you to specify the URL path, HTTP method, and other parameters to define how the request should be routed to the appropriate method. The other options, such as @ResponseBody, @PostMapping, and @Autowired, serve different purposes in Spring Boot but are not used for request mapping.
Loading...
Related Quiz
- When testing with @WebMvcTest, what considerations should be made regarding the security configurations of the application?
- Suppose you are working on a Spring Boot project and need to ensure that certain fields in the incoming request payload are consistent with each other (e.g., startDate should be before endDate). How would you implement this validation?
- To define a global default exception handler for unhandled exceptions in Spring Boot, you can use a _____ with the highest precedence.
- How can you customize the Maven or Gradle build file to include additional build steps in a Spring Boot project?
- In Spring Boot, the _____ annotation is used to indicate that a method's return value should be stored in the cache.