【Java.Spring.MVC】Controller

Spring文档中对于Controller的定义:

Controllers interpret user input and transform it into a model that is represented to the user by the view.

Spring2,5引入了基于注解(annotation)的Controller编程模型,Controller不需要继承特定的类或实现特定的接口。


@Controller注解指定controller

@Controller注解指定对应的类扮演controller的角色,dispatcher会扫描被注解的类并查找@RequestMapping注解。

为了自动检测注解的controller,在配置中添加component scanning -:

<context:component-scan base-package="org.springframework.samples.petclinic.web"/>

@RequestMapping注解映射请求

使用@RequestMapping注解将URL映射到整个类或类的特定方法。

通常,

  • 类级别的注解指定该controller中所有处理请求的方法的相对路径。
  • 方法级别的注解指定特定HTTP请求方法(GET,POST)及请求参数。

类级别的@RequestMapping不是必须的;如果没指定,则方法上的路径是绝对路径,不是相对路径。


URI Template Patterns

URL模板用在@RequestMapping注解的方法上;URI模板是一个URL-Like的字符串,包含一个或多个变量名

例如:URI模板包含变量userId

http://www.example.com/users/{userId}


将值 fred 赋给该变量,变为URI:

http://www.example.com/users/fred

@PathVariable

在Spring MVC中,使用@PathVariable注解将方法的参数与URI模板的变量绑定在一起。

To process the @PathVariable annotation, Spring MVC needs to find the matching URI template variable by name. You can specify it in the annotation:
@RequestMapping(value="/owners/{ownerId}", method=RequestMethod.GET)
public String findOwner(@PathVariable("ownerId") String theOwner, Model model) {
    // implementation omitted
}


Or if the URI template variable name matches the method argument name you can omit that detail. As long as your code is not compiled without debugging information, Spring MVC will match the method argument name to the URI template variable name:
@RequestMapping(value="/owners/{ownerId}", method=RequestMethod.GET)
public String findOwner(@PathVariable String ownerId, Model model) {
    // implementation omitted
}


  • 一个方法可以包含任意个@PathVariable注解。
  • @PathVariable注解的函数参数可以为任意的简单数据类型如String, long, int, Date等。Spring会自动转换为合适的类型或抛出 TypeMismatchException异常。
  • @PathVaribale如果用在Map<String, String>类型的参数上, map中包含URI模板中全部的变量。

示例: 如下URL - /owners/42/pets/21

@Controller
@RequestMapping("/owners/{ownerId}")
public class RelativePathUriTemplateController {

    @RequestMapping("/pets/{petId}")
    public void findPet(@PathVariable String ownerId, @PathVariable String petId, Model model) {
        // implementation omitted
    }

}

URI Template中的正则表达式

@RequestMapping注解支持在URI模板中对变量使用正则表达式。

语法如下:

{varName:regex}


例如:URL - "/spring-web/spring-web-3.0.5.jar"

@RequestMapping("/spring-web/{symbolicName:[a-z-]}-{version:\\d\\.\\d\\.\\d}{extension:\\.[a-z]}")
    public void handle(@PathVariable String version, @PathVariable String extension) {
        // ...
    }
}

Path Pattern

除了URI Template,@RequestMapping注解还支持Ant风格的路径模式(如: /myPath/*.do)。或组合使用URI Template和Path Pattern(如:/owners/*/pets/{petId})。

URL匹配优先级

当URL匹配多个pattern时,需要排序找到特定的匹配。


占位符Placeholders

注解@RequestMapping支持${...}占位符。


Matrix Variables


Media Types映射请求

Consumable Media Types

匹配请求header中的参数Content-Type,

@Controller
@RequestMapping(value = "/pets", method = RequestMethod.POST, consumes="application/json")
public void addPet(@RequestBody Pet pet, Model model) {
    // implementation omitted
}

Producible Media Types

匹配请求header中的Accept参数,

@Controller
@RequestMapping(value = "/pets/{petId}", method = RequestMethod.GET, produces="application/json")
@ResponseBody
public Pet getPet(@PathVariable String petId, Model model) {
    // implementation omitted
}

方法级别的Media Type会覆盖类级别的Media Type.


使用请求(头)参数/值来映射请求

You can narrow request matching through request parameter conditions such as "myParam""!myParam", or "myParam=myValue"

@Controller
@RequestMapping("/owners/{ownerId}")
public class RelativePathUriTemplateController {

    @RequestMapping(value = "/pets/{petId}", method = RequestMethod.GET, params="myParam=myValue")
    public void findPet(@PathVariable String ownerId, @PathVariable String petId, Model model) {
        // implementation omitted
    }

}

The same can be done to test for request header presence/absence or to match based on a specific request header value:

@Controller
@RequestMapping("/owners/{ownerId}")
public class RelativePathUriTemplateController {

    @RequestMapping(value = "/pets", method = RequestMethod.GET, headers="myHeader=myValue")
    public void findPet(@PathVariable String ownerId, @PathVariable String petId, Model model) {
        // implementation omitted
    }

}

定义@RequestMapping 处理函数

@RequestMapping修饰的处理函数有很灵活的函数声明(signature)形式(参数,返回值)。


可用的方法参数类型

  • Servlet API中的Request和Response对象,例如,HttpServletRequest, HttpServletResponse等
  • Servlet API中的Session对象,HttpSession。
  • org.springframework.web.context.request.WebRequest or org.springframework.web.context.request.NativeWebRequest
  • java.util.Locale
  • java.io.InputStream, java.io.Reader - 访问Request中的内容
  • java.io.OutputStrem, java.io.Writer - 生成Response的内容
  • org.springframework.http.HttpMethod - Http Request Method
  • java.security.Principal -  containing the currently authenticated user
  • HttpEntity<?>参数
  • java.util.Map, org.springframework.ui.Model, org.springframework.ui.ModelMap - 在web view中使用的Model
  • org.springframework.web.servlet.mvc.support.RedirectAttributes - 当redirect时
  • org.springframework.web.bind.support.SessionStatus - 
  • org.springframework.web.util.UriComponentsBuilder-
  • org.springframework.validation.Errors / org.springframework.validation.BindingResult
  • @PathVairalbe注解 - 访问URI Template中的变量的值
  • @MatrixVariable注解 - 访问URL Path中的值
  • @RequestParam注解 - 访问请求中的参数值;参数值转换为对应的参数类型
  • @RequestHeader注解 - 访问请求中的HTTP Header;参数值转换为对应的函数参数类型
  • @RequestBody注解 - 访问Request HTTP Body
  • @RequestPart注解 - 访问请求中的"multipart/form-data"内容
  • @ModelAttribute注解 -

可用的方法返回值类型

  • ModelAndView对象 - 
  • Model对象 - 
  • Map对象 - 
  • View对象 - 
  • String对象 - View名称,通常带Model参数填入数据(enrich)
  • void - 该方法内部写入response的内容(如传入一个Response参数);或者通过RequestToViewNameTranslator隐式确定View的名称
  • HttpHeaders对象 - 返回一个没有Body的response
  • Callable<?> - can be returned when the application wants to produce the return value asynchronously in a thread managed by Spring MVC
  • DeferredResult<?> - can be returned when the application wants to produce the return value from a thread of its own choosing.
  • ListenableFuture<?> - can be returned when the application wants to produce the return value from a thread of its own choosing.
  • HttpEntity<?>,ResponseEntity<?> - 
  • 其他类型的返回值 - is considered to be a single model attribute to be exposed to the view

使用方法

使用@RequestParam注解将请求参数绑定到方法参数

使用该注解指定的参数默认是必须的required;但是可以通过指定注解的required属性为false,将该参数指定为可选的(@RequestParam(value = 'id', required = false))。

如果目标方法参数的类型不是String,将会进行类型的自动转换。

如果@RequestParam注解应用到Map<String, String>或者MultiValueMap<String, String>类型的参数,map中将包含全部的参数。

示例:

<span style="font-size:10px;">@Controller
@RequestMapping("/pets")
@SessionAttributes("pet")
public class EditPetForm {
    // ...
    @RequestMapping(method = RequestMethod.GET)
    public String setupForm(@RequestParam("petId") int petId, ModelMap model) {
        Pet pet = this.clinic.loadPet(petId);
        model.addAttribute("pet", pet);
        return "petForm";
    }
    // ...
}</span>

使用@RequestBody注解映射request body

@RequestBody方法注解指定一个方法参数应该绑定为HTTP request body的值。

例如:

@RequestMapping(value = "/something", method = RequestMethod.PUT)
public void handle(@RequestBody String body, Writer writer) throws IOException {
    writer.write(body);
}

使用HttpMessageConverter可以将request body转换为方法参数。HttpMessageConverter负责将HTTP request message转换为一个Object,或者将一个Object转换为HTTP response body。

RequestMappingHandlerAdapter支持下列默认的HttpMessageConverters:

  • ByteArrayHttpMessageConverter - 转换为字节数组
  • StringHttpMessageConverter - 转换为strings
  • FormHttpMessageConverter - 转换表单为从表单数据转为为MultiValueMap<String, String>
  • SourceHttpMessageConverter - 转为为/从 javax.xml.transform.Source

如果使用MVC namespace 或者MVC Java Config,默认会注册更多的message converters。

如果打算写入/读取XML,需要进行如下配置:

<bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
    <property name="messageConverters">
        <util:list id="beanList">
            <ref bean="stringHttpMessageConverter"/>
            <ref bean="marshallingHttpMessageConverter"/>
        </util:list>
    </property
</bean>

<bean id="stringHttpMessageConverter"
        class="org.springframework.http.converter.StringHttpMessageConverter"/>

<bean id="marshallingHttpMessageConverter"
        class="org.springframework.http.converter.xml.MarshallingHttpMessageConverter">
    <property name="marshaller" ref="castorMarshaller" />
    <property name="unmarshaller" ref="castorMarshaller" />
</bean>

<bean id="castorMarshaller" class="org.springframework.oxm.castor.CastorMarshaller"/>

使用@ResponseBody注解映射response body

@ResponseBody与@RequestBody注解类似。该注解位于方法level,指定函数返回值类型应该直接写入为HTTP response body。

例如:

@RequestMapping(value = "/something", method = RequestMethod.PUT)
@ResponseBody
public String helloWorld() {
    return "Hello World";
}

上面的示例将文本“Hello World”写入到HTTP response stream中。

同@RequestBody一样,Spring通过HttpMessageConverter将返回值对象转换为response body。

使用@RestController注解创建REST Controllers

Controller实现REST API,只处理JSON,XML或custom MediaType内容。

可以通过在类level使用@RestController,来代替在@RequestMapping注解方法上使用@ResponseBody.

@RestController注解组合了@RequestBody和@Controller注解。

使用HttpEntity

HttpEntity类似于@RequestBody和@ResponseBody注解。除了可以访问request和response body外, HttpEntity还允许访问request和response headers。

例如:

@RequestMapping("/something")
public ResponseEntity<String> handle(HttpEntity<byte[]> requestEntity) throws UnsupportedEncodingException {
    String requestHeader = requestEntity.getHeaders().getFirst("MyRequestHeader"));
    byte[] requestBody = requestEntity.getBody();

    // do something with request header and body

    HttpHeaders responseHeaders = new HttpHeaders();
    responseHeaders.set("MyResponseHeader", "MyValue");
    return new ResponseEntity<String>("Hello World", responseHeaders, HttpStatus.CREATED);
}

上面的示例得到request header中的MyRequestHeader,将request body写入一个字节数组。它将MyRequestHeader添加到response中,写入文本“Hello World”到response stream中,并设置response status code为201

同@RequestBody和@ResponseBody一样,Spring使用HttpMessageConverter转换request和response streams.

在方法上使用@ModelAttribute

@ModelAttribute注解可以应用在方法或这方法的参数上。

方法上的@ModelAttribute注解标识着这些方法用来添加一个或者多个属性到model中;在一个controller类中,@ModelAttribute方法会在@RequestMapping注解的方法被调用之前被调用

// Add one attribute
// The return value of the method is added to the model under the name "account"
// You can customize the name via @ModelAttribute("myAccount")

@ModelAttribute
public Account addAccount(@RequestParam String number) {
    return accountManager.findAccount(number);
}

// Add multiple attributes

@ModelAttribute
public void populateModel(@RequestParam String number, Model model) {
    model.addAttribute(accountManager.findAccount(number));
    // add more ...
}

在上面的两个例子中,第一个方法通过返回值来隐式的添加一个属性到model中;第二个方法接受一个model参数,然后添加一些model属性。可以选择任意一种使用方法。

一个controller类可以有任意数量的@ModelAttribute注解的方法,这些方法会在同一个controller内部的@RequestMapping注解的方法被调用之前被调用。

在第一个例子中,没有显示的指定model attribute的名字,在这种情况下,会基于其类型分哦诶一个默认的model attrbite的名字。例如,方法返回一个Account类型的对象,那么默认的model attribute的名字就是“account”。可以通过改变@ModelAttribute注解的值来指定名字。在第二个例子中,直接添加属性到model中,可以通过调用重载的addAttribute方法选择指定或不指定属性的名字。

在方法参数上使用@ModelAttribute注解

方法参数上的@ModelAttribute注解指示该参数应该从model中获取。如果不在model中,该参数应该首先被实例化然后添加到model中。然后该参数的fields使用request中名字匹配的参数进行填充。

例如:

@RequestMapping(value="/owners/{ownerId}/pets/{petId}/edit", method = RequestMethod.POST)
public String processSubmit(@ModelAttribute Pet pet) { }

Pet示例可能来自:

  • 可能已经存在与model中(使用@SessionAttributes)
  • 可能已经存在于model中(在同一个controller类中,使用@ModelAttribute注解的方法)
  • 基于URL模板和类型转换获得
  • 使用默认构造函数实例化

例如:

@RequestMapping(value="/accounts/{account}", method = RequestMethod.PUT)
public String save(@ModelAttribute("account") Account account) {

}

在该例子中,model attribute的名字(account)与URI模板中的变量相匹配。如果注册了Converter<String,Account>,那么不需要@ModelAttribute方法。

第二部是data binding。WebDataBinder类匹配请求参数名(包括查询参数和表单参数)到model属性。

数据绑定的结果可能包含错误(例如缺少required fileds或类型转换错误)。为了检测错误,可以在@ModelAttribute参数后面添加一个BindingResult参数:

@RequestMapping(value="/owners/{ownerId}/pets/{petId}/edit", method = RequestMethod.POST)
public String processSubmit(@ModelAttribute("pet") Pet pet, BindingResult result) {

    if (result.hasErrors()) {
        return "petForm";
    }

    // ...

}

可以调用自定义的validator,

@RequestMapping(value="/owners/{ownerId}/pets/{petId}/edit", method = RequestMethod.POST)
public String processSubmit(@ModelAttribute("pet") Pet pet, BindingResult result) {

    new PetValidator().validate(pet, result);
    if (result.hasErrors()) {
        return "petForm";
    }

    // ...

}

或者使用@Valid直接自动验证,

@RequestMapping(value="/owners/{ownerId}/pets/{petId}/edit", method = RequestMethod.POST)
public String processSubmit(@Valid @ModelAttribute("pet") Pet pet, BindingResult result) {

    if (result.hasErrors()) {
        return "petForm";
    }

    // ...

}

使用@SessionAttributes注解在HTTP Session的requests之间存储model attributes

下面的示例-指定model attribute的名字:

@Controller
@RequestMapping("/editPet.do")
@SessionAttributes("pet")
public class EditPetForm {
    // ...
}


指定redirect和flash属性


处理“application/x-www-form-urlencoded”数据(HTTP PUT, PATCH请求)


使用@CookieValue注解映射cookie值

@CookieValue注解将方法参数绑定到HTTP Cookie的值。

例如:cookie值:JSESSIONID=415A1AC1786... ...

@RequestMapping("/displayHeaderInfo.do")
public void displayHeaderInfo(@CookieValue("JSESSIONID") String cookie) {
    //...
}

如果方法参数的类型不是String,则进行自动类型转换。

使用@RequestHeader注解映射request header属性

@RequestHeader注解将方法参数绑定到request header。

Host                    localhost:8080
Accept                  text/html,application/xhtml+xml,application/xml;q=0.9
Accept-Language         fr,en-gb;q=0.7,en;q=0.3
Accept-Encoding         gzip,deflate
Accept-Charset          ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive              300

获得Accept-Encoding和Keep-Alive头:

@RequestMapping("/displayHeaderInfo.do")
public void displayHeaderInfo(@RequestHeader("Accept-Encoding") String encoding,
        @RequestHeader("Keep-Alive") long keepAlive) {
    //...
}

如果方法参数不是String,自动进行类型转换。

如果@RequestHeader注解用在Map<String,String>,MultiValueMap<String,String>,HttpHeaders参数上,map中包含全部的header的值。


方法参数及类型转换

如果类型不是String,Spring自动转换为适当的类型。可以通过WebDataBinder或者注册Formatters自定义转换过程。

*Request处理函数常用注解总结

根据处理请求request的不同内容部分,常用的注解annotation可大致分为4类:

  • 处理 requet uri 部分(这里指uri template中variable,不含queryString部分)的注解 —— @PathVariable;
  • 处理 request header部分的注解 —— @RequestHeader, @CookieValue;
  • 处理 request body部分的注解 —— @RequestParam,  @RequestBody;
  • 处理 attribute类型的注解 —— @SessionAttributes, @ModelAttribute;

@PathVariable

当使用@RequestMapping URI template 样式映射时, 即型如someUrl/{paramId}, 这时的paramId可通过 @Pathvariable注解绑定它传过来的值到方法的参数上。

例如:

@Controller  
@RequestMapping("/owners/{ownerId}")  
public class RelativePathUriTemplateController {  
  
  @RequestMapping("/pets/{petId}")  
  public void findPet(@PathVariable String ownerId, @PathVariable String petId, Model model) {      
    // implementation omitted  
  }  
}  

上面代码把URI template 中变量 ownerId的值和petId的值,绑定到方法的参数上。若方法参数名称和需要绑定的uri template中变量名称不一致,需要在@PathVariable("name")指定uri template中的名称。

@RequestHeader, @CookieValue

@RequestHeader 注解,可以把Request请求header部分的值绑定到方法的参数上。

例如:

一个Request的Header部分:

Host                    localhost:8080  
Accept                  text/html,application/xhtml+xml,application/xml;q=0.9  
Accept-Language         fr,en-gb;q=0.7,en;q=0.3  
Accept-Encoding         gzip,deflate  
Accept-Charset          ISO-8859-1,utf-8;q=0.7,*;q=0.7  
Keep-Alive              300 
@RequestMapping("/displayHeaderInfo.do")  
public void displayHeaderInfo(@RequestHeader("Accept-Encoding") String encoding,  
                              @RequestHeader("Keep-Alive") long keepAlive)  {  
  
  //...  
  
} 

上面的代码,把request header部分的 Accept-Encoding的值,绑定到参数encoding上了, Keep-Alive header的值绑定到参数keepAlive上。


@CookieValue 可以把Request header中关于cookie的值绑定到方法的参数上。

例如如下cookie值:

JSESSIONID=415A4AC178C59DACE0B2C9CA727CDD84 
@RequestMapping("/displayHeaderInfo.do")  
public void displayHeaderInfo(@CookieValue("JSESSIONID") String cookie)  {  
  
  //...  
  
}

即把JSESSIONID的值绑定到参数cookie上。

@RequestParam, @RequestBody

@RequestParam

  • 常用来处理简单类型的绑定,通过Request.getParameter() 获取的String可直接转换为简单类型的情况( String-->简单类型的转换操作由ConversionService配置的转换器来完成);因为使用request.getParameter()方式获取参数,所以可以处理HTTP GET方式中queryString的值,也可以处理HTTP POST方式中 body data的值;
  • 用来处理Content-Type: 为 application/x-www-form-urlencoded编码的内容,提交方式GET、POST;
  • 该注解有两个属性: value、required; value用来指定要传入值的id名称,required用来指示参数是否必须绑定;

示例代码:

@Controller  
@RequestMapping("/pets")  
@SessionAttributes("pet")  
public class EditPetForm {  
  
    // ...  
  
    @RequestMapping(method = RequestMethod.GET)  
    public String setupForm(@RequestParam("petId") int petId, ModelMap model) {  
        Pet pet = this.clinic.loadPet(petId);  
        model.addAttribute("pet", pet);  
        return "petForm";  
    } 


@RequestBody

该注解常用来处理Content-Type: 不是application/x-www-form-urlencoded编码的内容,例如application/json, application/xml等;

它是通过使用HandlerAdapter 配置的HttpMessageConverters来解析post data body,然后绑定到相应的bean上的。

因为配置有FormHttpMessageConverter,所以也可以用来处理 application/x-www-form-urlencoded的内容,处理完的结果放在一个MultiValueMap<String, String>里,这种情况在某些特殊需求下使用,详情查看FormHttpMessageConverter api;

实例代码:

@RequestMapping(value = "/something", method = RequestMethod.PUT)  
public void handle(@RequestBody String body, Writer writer) throws IOException {  
  writer.write(body);  
} 

@SessionAttribute, @ModelAttribute

@SessionAttribute

该注解用来绑定HttpSession中的attribute对象的值,便于在方法中的参数里使用。

该注解有value、types两个属性,可以通过名字和类型指定要使用的attribute 对象;

示例代码:

@Controller  
@RequestMapping("/editPet.do")  
@SessionAttributes("pet")  
public class EditPetForm {  
    // ...  
} 

@ModelAttribute

该注解有两个用法,一个是用于方法上,一个是用于参数上;

  • 用于方法上时:  通常用来在调用处理具体@RequestMapping的handler函数之前,为请求绑定需要从后台查询的model(绑定一个attribute到model中)
  • 用于参数上时: 用来通过名称对应,把相应名称的值绑定到注解的参数bean上;要绑定的值来源于:
    •  @SessionAttributes 启用的attribute 对象上;
    •  @ModelAttribute 用于方法上时指定的model对象(通过model attribute name寻找)
    • 上述两种情况都没有时,new一个需要绑定的bean对象,然后把request中按名称对应的方式把值绑定到bean中(将request中参数按名称与bean的field名称对应的方式,为bean的field赋值)

用到方法上示例代码:

// Add one attribute  
// The return value of the method is added to the model under the name "account"  
// You can customize the name via @ModelAttribute("myAccount")  
  
@ModelAttribute  
public Account addAccount(@RequestParam String number) {  
    return accountManager.findAccount(number);  
} 

这种方式实际的效果就是在调用@RequestMapping的方法之前,为request对象的model里put(“account”, Account);

用在参数上示例代码:

@RequestMapping(value="/owners/{ownerId}/pets/{petId}/edit", method = RequestMethod.POST)  
public String processSubmit(@ModelAttribute Pet pet) {  
     
} 

首先查询 @SessionAttributes有无绑定的Pet对象,若没有则查询@ModelAttribute方法层面上是否绑定了Pet对象,若没有则将URI template中的值(或:request中的值)按对应的名称绑定到Pet对象的各属性上。

*不使用注解时,request处理函数的参数如何绑定

通过分析AnnotationMethodHandlerAdapter和RequestMappingHandlerAdapter的源代码发现,方法的参数在不给定参数的情况下:

  • 若要绑定的对象时简单类型:  调用@RequestParam来处理的。  
  • 若要绑定的对象时复杂类型:  调用@ModelAttribute来处理的。

这里的简单类型指java的原始类型(boolean, int 等)、原始类型对象(Boolean, Int等)、String、Date等ConversionService里可以直接String转换成目标对象的类型;

示例:

@RequestMapping ({"/", "/home"})  
    public String showHomePage(String key){  
        logger.debug("key="+key);  
        return "home";  
    }  

这种情况下,就调用默认的@RequestParam来处理。

@RequestMapping (method = RequestMethod.POST)  
public String doRegister(User user){  
    if(logger.isDebugEnabled()){  
        logger.debug("process url[/user], method[post] in "+getClass());  
        logger.debug(user);  
    }  
    return "user";  
}


这种情况下,就调用@ModelAttribute来处理。


异步请求处理









  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
Required request body is missing: public java.util.Map<java.lang.String, java.lang.Object> com.cntomorrow.zxkt.admin.modules.plugins.workTransparent.controller.WorkTransparentController.splitItme(com.cntomorrow.zxkt.admin.modules.plugins.workTransparent.entity.Deverc) at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.readWithMessageConverters(RequestResponseBodyMethodProcessor.java:161) at org.springframework.web.servlet.mvc.method.annotation.RequestResponseBodyMethodProcessor.resolveArgument(RequestResponseBodyMethodProcessor.java:131) at org.springframework.web.method.support.HandlerMethodArgumentResolverComposite.resolveArgument(HandlerMethodArgumentResolverComposite.java:121) at org.springframework.web.method.support.InvocableHandlerMethod.getMethodArgumentValues(InvocableHandlerMethod.java:167) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:134) at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:105) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:879) at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:793) at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87) at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1040) at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:943) at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1006) at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:909)
06-02

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值