org.springframework.web.bind.support.WebExchangeBindException.<init>()方法的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(2.7k)|赞(0)|评价(0)|浏览(148)

本文整理了Java中org.springframework.web.bind.support.WebExchangeBindException.<init>()方法的一些代码示例,展示了WebExchangeBindException.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。WebExchangeBindException.<init>()方法的具体详情如下:
包路径:org.springframework.web.bind.support.WebExchangeBindException
类名称:WebExchangeBindException
方法名:<init>

WebExchangeBindException.<init>介绍

暂无

代码示例

代码示例来源:origin: spring-projects/spring-framework

private void validate(Object target, Object[] validationHints, MethodParameter param,
    BindingContext binding, ServerWebExchange exchange) {
  String name = Conventions.getVariableNameForParameter(param);
  WebExchangeDataBinder binder = binding.createDataBinder(exchange, target, name);
  binder.validate(validationHints);
  if (binder.getBindingResult().hasErrors()) {
    throw new WebExchangeBindException(param, binder.getBindingResult());
  }
}

代码示例来源:origin: spring-projects/spring-framework

if (adapter != null) {
  return adapter.fromPublisher(errors.hasErrors() ?
      Mono.error(new WebExchangeBindException(parameter, errors)) :
      valueMono);
    throw new WebExchangeBindException(parameter, errors);

代码示例来源:origin: org.springframework/spring-web-reactive

protected void validate(Object target, Object[] validationHints,
    MethodParameter param, BindingContext binding, ServerWebExchange exchange) {
  String name = Conventions.getVariableNameForParameter(param);
  WebExchangeDataBinder binder = binding.createDataBinder(exchange, target, name);
  binder.validate(validationHints);
  if (binder.getBindingResult().hasErrors()) {
    throw new WebExchangeBindException(param, binder.getBindingResult());
  }
}

代码示例来源:origin: org.springframework/spring-web-reactive

if (adapter != null) {
  return adapter.fromPublisher(errors.hasErrors() ?
      Mono.error(new WebExchangeBindException(parameter, errors)) :
      Mono.just(value));
    throw new WebExchangeBindException(parameter, errors);

代码示例来源:origin: spring-cloud/spring-cloud-open-service-broker

@Test
public void webExchangeBindExceptionException() throws NoSuchMethodException {
  BindingResult bindingResult = new MapBindingResult(new HashMap<>(), "objectName");
  bindingResult.addError(new FieldError("objectName", "field1", "message"));
  bindingResult.addError(new FieldError("objectName", "field2", "message"));
  Method method = this.getClass().getMethod("setUp", (Class<?>[]) null);
  MethodParameter parameter = new MethodParameter(method, -1);
  WebExchangeBindException exception =
      new WebExchangeBindException(parameter, bindingResult);
  ErrorMessage errorMessage = exceptionHandler.handleException(exception);
  assertThat(errorMessage.getError()).isNull();
  assertThat(errorMessage.getMessage()).contains("field1");
  assertThat(errorMessage.getMessage()).contains("field2");
}

相关文章