스프링 부트(핵심 원리와 활용)

Ch07. 액츄에이터 - 액츄에이터 시작

webmaster 2023. 3. 20. 01:02
728x90

액츄에이터가 제공하는 프로덕션 준비 기능을 사용하려면 스프링 부트 액츄에이터 라이브러리를 추가해야 한다.

build.gradle

dependencies {
    implementation 'org.springframework.boot:spring-boot-starter-actuator' //actuator 추가
}

액추에이터 기능

http://localhost:8080/actuator로 접근하면, 기본적으로 제공하는 기능을 사용할 수 있다.

http://localhost:8080/actuator
  • 액츄에이터는 /actuator 경로를 통해서 기능을 제공한다.

http://localhost:8080/actuator/health로 접근하자

http://localhost:8080/actuator/health

  • 이 기능은 현재 서버가 잘 동작하고 있는지 애플리케이션의 헬스 상태를 나타낸다.

액츄에이터 기능을 웹에 노출

application.yml

management:
  endpoints:
    web:
      exposure:
        include: "*"

http://localhost:8080/actuator 로 접근

http://localhost:8080/actuator

  • 액츄에이터가 제공하는 수 많은 기능을 확인할 수 있다.
  • 액츄에이터가 제공하는 기능 하나하나를 엔드포인트라 한다.
    • health 는 헬스 정보를, beans 는 스프링 컨테이너에 등록된 빈을 보여준다.
  • 각각의 엔드포인트는 /actuator/{엔드포인트명} 과 같은 형식으로 접근할 수 있다.
    • http://localhost:8080/actuator/health : 애플리케이션 헬스 정보를 보여준다.
    • http://localhost:8080/actuator/beans : 스프링 컨테이너에 등록된 빈을 보여준다.
 

 

728x90