liveBook · Manning

@getmapping

As explained in Spring Start Here, Second Edition

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.

Also explained in

Compare how 2 books explain @getmapping →

Related concepts

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.