The @GetMapping annotation maps a Spring MVC method to HTTP GET requests for a specified path.
@GetMapping maps an HTTP GET request to a controller action at a specified path. It gives GET requests a dedicated annotation instead of setting the HTTP method on @RequestMapping. section 8.2
Display products
Annotate a controller action with @GetMapping("/products") to handle GET requests for /products. The action retrieves the product list and returns the products.html view. section 8.2
How Spring Start Here, Second Edition covers it
How deep it goes
Defines the dedicated mapping and contrasts it with @RequestMapping; does not explain framework internals.
Examples
Uses a /products controller action to retrieve products and return an HTML view.
What you can do after
Apply it to map a controller action to GET requests at a chosen path.
How it connects
Contrasts with @RequestMapping and pairs with @PostMapping for HTTP POST actions.
HTTP GETconfigures · HTTP GET is a safe, idempotent HTTP method that requests a representation of a resource without intending to change its state.
endpointconfigures · An endpoint is an addressable interface of a service through which clients access a resource or invoke an operation, typically via a network request.
RESTuses · REST is an architectural style for distributed systems that organizes interactions around identifiable resources and their representations, using a uniform interface and constraints such as statelessness and cacheability.
@postmappingcontrasts with · @PostMapping is a Spring MVC annotation that maps HTTP POST requests to a controller method.
@requestmappingconfigured by · @RequestMapping is a Spring annotation that associates HTTP request patterns and conditions with controller classes or handler methods.
This explainer was generated by Manning's knowledge graph from the text of Spring Start Here, Second Edition. The section links point to the parts of the book it draws on.