# Spring Actuator

## Spring Actuator란

> Spring Boot includes a number of additional features to help you monitor and manage your application when you push it to production. You can choose to manage and monitor your application by using HTTP endpoints or with JMX. Auditing, health, and metrics gathering can also be automatically applied to your application.
>
> *Spring Boot에는 프로덕션에 푸시 할 때 응용 프로그램을 모니터링하고 관리하는 데 도움이되는 여러 가지 추가 기능이 포함되어 있습니다. HTTP 엔드포인트 또는 JMX를 사용하여 애플리케이션을 관리하고 모니터링하도록 선택할 수 있습니다. 감사, 상태 및 메트릭 수집도 응용 프로그램에 자동으로 적용될 수 있습니다.*
>
> <https://docs.spring.io/spring-boot/docs/2.0.x/reference/html/production-ready.html>

**Spring Actuator**를 설정하면 Spring Boot Dashboard에서 Spring Boot Application에 대한 각종 상태 확인이 가능하다. 프로젝트는 [Redirect](/web/back-end/spring-boot/spring-controller/redirect.md) 에서 만든 프로젝트를 사용한다.

## 의존성 추가

의존성 추가는 <mark style="color:blue;">`pom.xml`</mark>에 직접 하거나 <mark style="color:blue;">`Add starters`</mark> 메뉴를 사용한다.

### pom.xml

<pre class="language-markup"><code class="lang-markup">&#x3C;dependency>
<strong>    &#x3C;groupId>org.springframework.boot&#x3C;/groupId>
</strong>    &#x3C;artifactId>spring-boot-starter-actuator&#x3C;/artifactId>
&#x3C;/dependency>
</code></pre>

### Add Starters

프로젝트 우클릭 후 Spring → Add Starters 메뉴에서 <mark style="color:blue;">`Spring Boot Actuator`</mark>를 선택한다. 파일 선택창이 나오면 <mark style="color:blue;">`pom.xml`</mark>을 선택하고 확인을 누른다.

<div align="left"><figure><img src="/files/wOMehVvYputFMu8lveBC" alt=""><figcaption></figcaption></figure></div>

<mark style="color:blue;">`pom.xml`</mark>에 의존성이 추가된 것을 확인할 수 있다.

## Actuator 활성화 설정

의존성을 추가했으면 Actuator를 사용할 수 있도록 설정해야 한다. 설정이 이루어지지 않은 경우 Boot Dashboard에서 <mark style="color:blue;">`Show Properties`</mark> 메뉴를 누르면 다음과 같이 메세지가 나온다.

<div align="left"><figure><img src="/files/hspT4UVEre7pDMEurUfP" alt=""><figcaption></figcaption></figure></div>

{% hint style="info" %} <mark style="color:red;">프로젝트가 실행중이어야 한다.</mark>
{% endhint %}

요구하는대로 <mark style="color:red;">`mappings`</mark>, <mark style="color:red;">`beans`</mark>, <mark style="color:red;">`env`</mark>에 대한 Actuator 설정을 확인할 수 있도록 <mark style="color:blue;">`application.properties`</mark>에 다음과 같이 설정한다.

```properties
management.endpoints.web.exposure.include=mappings,beans,env
```

## Boot Dashboard 확인

프로젝트를 재시작한 뒤 적용된 프로젝트에서 <mark style="color:blue;">`Show Properties`</mark> 메뉴를 누르면 분석 가능한 요소들이 표시되는 것을 확인할 수 있다.

<div align="left"><figure><img src="/files/vhocLnARmmv5TatLjGsn" alt=""><figcaption></figcaption></figure></div>


---

# Agent Instructions: 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://docs.sysout.co.kr/web/back-end/spring-boot/spring-controller/spring-actuator.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.
