> 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-boot/undefined-1/23.-spring-application-by-ys/23.4.md).

# 23.4  Fluent Builder API

{% hint style="info" %}
Fluent : 유창한
{% endhint %}

만약 계층관계 `ApplicationContext` [1](https://kgmyh.github.io/blog/2017/12/10/spring-boot-chapter04/#fn:1)를 생성해야 하거나 'fluent' builder[2](https://kgmyh.github.io/blog/2017/12/10/spring-boot-chapter04/#fn:2) API를 사용하는 것을 선호한다면 `SpringApplicationBuilder`를 사용할 수 있다.

`SpringApplicationBuilder`는 여러 메소드 호출을 연결해서 호출method chain 할 수있게 하고 계층관계를 만들수 있는 `parent`와 `child` 메소드를 포함하고 있다.\
예)

```java
new SpringApplicationBuilder()
               .sources(Parent.class)
               .child(Application.class)
               .bannerMode(Banner.Mode.OFF)
               .run(args);
```

| ![\[노트\]](https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/images/note.png)                                                                                                                                                                                                                                |
| ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `ApplicationContext` 계층관계를 생성할 때 몇몇 제약이 있다. 예를 들어 웹 컴포넌트는 **반드시** 자식 context에 포함되 있어야 한다. 그리고 같은 `Environment`가 부모와 자식 컨텍스트들 양쪽에서 사용되어야 한다. 자세한 사항은 [`SpringApplicationBuilder`Javadoc](https://docs.spring.io/spring-boot/docs/2.0.0.BUILD-SNAPSHOT/api/org/springframework/boot/builder/SpringApplicationBuilder.html)을 보시오. |
