ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
``` 1. 该注解可以在类,方法上使用 2. 在类上面就会把请求或请求模式映射到控制器上 3. 在方法上面就会把请求映射到控制器方法上 ``` ### 参数 ``` value 指定请求的实际地址 name 给映射地址指定一个别名 method RequestMethod[] 否 指定请求的 method 类型, 包括 GET、 POST、 PUT、 DELETE 等 consumer 指定处理请求的提交内容类型( Content-Type ) ,例如application/ json, text/html produces 指定返回的内容类型,返回的内容类型必须是 request 请求头 中的( Accept)类型中包含该指定类型 params 指定 request 中必须包含某些参数值时,才能让该方法处理 headers 指定 request 中必须包含某些指定的 header 值时, 才能让该 方法处理请求 ``` ``` produces 和 consumes 属性来指定处理请求的提交内容 类型(Content句pe) 和返回的内容类型, 返回的类型必须是 request 请求头(Accept)中所包含 的类型 @RequestMapping(value = "/test", method = RequestMethod.GET, consumes = { "application/json", "application/xml" },produces = { "application/json" },headers = { "content-type=text/plain", "content-type=text/html", }) public void test(){ } ```