Home  >  Article  >  Java  >  @requestmapping annotation function

@requestmapping annotation function

(*-*)浩
(*-*)浩Original
2020-01-09 10:29:298407browse

@requestmapping annotation function

#RequestMapping is an annotation used to handle request address mapping, which can be used on classes or methods.

is used on a class, indicating that all methods in the class that respond to requests use this address as the parent path.                                                                                                                                       (Recommended learning: java course )

The RequestMapping annotation has six attributes, which are divided into three categories for explanation below.

value, method

value: Specify the actual address of the request. The specified address can be a specific address, dynamically obtained by RestFul, or set using regular rules;

method: Specify the method type of the request, which is divided into GET, POST, PUT, DELETE, etc.;

consumes, produces

consumes: Specify the request processing method Submit content type (Content-Type), such as application/json, text/html;

produces: Specifies the content type to be returned. It will only be returned if the (Accept) type in the request header contains the specified type. ;

params, headers

params: The specified request must contain certain parameter values ​​before it can be processed by this method.

headers: The specified request must contain certain specified header values ​​in order for this method to process the request.

For more Java-related technical articles, please visit the java tutorial column Get studying!

The above is the detailed content of @requestmapping annotation function. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn