Example 2

In the following example, there is a method defined on RequestMapping--RequestMethod.GET. The showPage method will be mapped only to the GET request for URI /show-page. All other request method types would throw "method not supported exception":

    @Controller     public class UserController {       @RequestMapping(value = "/show-page" , method =       RequestMethod.GET)       public String showPage() {         /* Some code */        }     }

Get Mastering Spring 5.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.