In a Spring MVC application, the URL can logically be divided into five parts (see the following figure); the @RequestMapping
annotation only matches against the URL request path. It omits the scheme, hostname, application name, and so on.
The @RequestMapping
annotation has one more attribute called method
to further narrow down the mapping based on the HTTP request method types (GET
, POST
, HEAD
, OPTIONS
, PUT
, DELETE
, and TRACE
). If we do not specify the method
attribute in the @RequestMapping
annotation, the default method will be GET.
The logical parts of a typical Spring MVC application URL