> For the complete documentation index, see [llms.txt](https://organization-bht.gitbook.io/it/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://organization-bht.gitbook.io/it/framework/spring-boot/undefined-1/springbootapplication.md). Agents can also search and read this documentation through its [MCP server](https://organization-bht.gitbook.io/it/~gitbook/mcp).

# SpringBootApplication

SpringBootApplication에 대해 알아볼 페이지

<figure><img src="https://3572862491-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUON3CGxVeoUR2YdtAhxl%2Fuploads%2FWfEZSTBnrLz8JdOwE6Sm%2Fimage.png?alt=media&amp;token=88de5063-d173-4395-a007-f84bcec1454a" alt=""><figcaption></figcaption></figure>

## Intro&#x20;

스프링부트는 **하나의 어노테이션**으로 다양한 설정을 자동으로 등록합니다. 스프링부트 프로젝트 생성시 자동으로 생성되는 파일에 존재하는 **@SpringBootApplication**은 어떤 설정들을 자동으로 등록하고 있는지 알아보도록 하겠습니다.

## SpringBootApplication

<figure><img src="https://3572862491-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FUON3CGxVeoUR2YdtAhxl%2Fuploads%2Ff23beYkjiJvZfiMrtUXX%2Fimage.png?alt=media&amp;token=1a49a347-e263-4fdc-9564-a89a5b04ddff" alt=""><figcaption></figcaption></figure>

`lombok`의 `@Get`, `@Set`, `@Tostring` 등 다양한 어노테이션들이 하나의 `@Data`어노테이션에서 통합되어 관리되고 있던게 기억나실까요? @SpringBootApplication도 마찬가지입니다. 위에서 보이는 @Target부터 @ComponentScan까지 다양한 어노테이션들을 **통합시킨 어노테이션**이  @SpringBootApplication인거죠. 그럼 각 어노테이션들에 대해 간단하게 살펴보도록 하겠습니다.

### 1) Target

* SpringBootApplication어노테이션을 사용할수 있는 Target을 지정하는 어노테이션입니다.

### 2) Retention

* 현재 어노테이션이 Runtime동안 유지되게끔 하는 설정입니다.

### 3) Documented

* 현재 어노테이션이  javdoc문서 생성시 포함되게하는 설정입니다.

### 4) Inherited

* 어노테이션이 적용된 자식클래스에도  현재 어노테이션을 상속시켜주는 설정입니다.

### 5) SpringBootConfiguration

* 현재 클래스가 Configuration역할의 bean객체임을 의미하는 설정입니다.

### 6) EnableAutoConfiguration

* 스프링부트의 자동설정을 활성화 하는 속성입니다.&#x20;
* classpath설정, bean객체등록 , context생성, 디스패쳐서블릿 생성등 다양한 작업을 수행합니다.

### 7) ComponentScan

* 어노테이션이 지정된 클래스의 패키지경로의 클래스를 탐색하여 bean객체로 등록하는 설정입니다.
