> For the complete documentation index, see [llms.txt](https://wannaqueen.gitbook.io/spring5/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://wannaqueen.gitbook.io/spring5/spring-5.0/3.-by-ys-sh/3.7-by-sh/3.7.3-by-sh.md).

# 3.7.3 by sh

### **3.7.3. DataBinder 구성**

**스프링 3 이후에 `Validator`로 `DataBinder`인스턴스를 설정할 수 있습니다. 일단 구성되면, `binder.validate()`를 호출하여 `Validator`를 유발할 수 있습니다. 모든 유효성 검사 `Errors`는 자동으로 바인더의 `BindingResult`에 추가됩니다.**

다음의 예는 프로그래밍적으로 `DataBinder`를 사용하여 대상 객체에 바인딩 한 후에 유효성 검사 로직을 호출하는 방법을 보여줍니다.

```java
Foo target = new Foo();
DataBinder binder = new DataBinder(target);
binder.setValidator(new FooValidator());

// bind to the target object
binder.bind(propertyValues);

// validate the target object
binder.validate();

// get BindingResult that includes any validation errors
BindingResult results = binder.getBindingResult();
```

`dataBinder.addValidators`및 `dataBinder.replaceValidators`를 통해 여러 `Validator`인스턴스로 `DataBinder`를 구성할 수도 있습니다. 이것은 DataBinder 인스턴스에 지역적으로 구성된 스프링 Validator와 함께 전역으로 구성된 빈 유효성 검사를 결합할 때 유용합니다. [\[validation-mvc-configuring\]](https://docs.spring.io/spring/docs/current/spring-framework-reference/core.html#validation-mvc-configuring)을 참조하십시오.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://wannaqueen.gitbook.io/spring5/spring-5.0/3.-by-ys-sh/3.7-by-sh/3.7.3-by-sh.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
