Şimdi bizim projemizin sağlığını,metric değerlerini yada monitor edip yönetmek istersek Spring Boot Actuator kullanmamız gerekiyor.
Spring Boot Actuator bizim için bazı endpointler üretir ve bu sayede projemizi görüntüleyebiliriz. Yapmamız gereken tek şey projemize pom.xml dosyasına eklemeyi yapmaktır.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>- Default olarak sadece /health endpointi exposed yani yayınlanmıştır.
- /info endpointi de bize uygulamamız hakkında bazı bilgiler sağlar. Eğer ki biz /info endpointini de expose etmek istiyorsak:
application.properties dosyasına:
management.endpoints.web.exposure.include=health,info
çalıştırabiliriz ama sonucunda bir şey görmeyeceğiz info için biz projemize biraz bilgi vermek istersek :
management.info.env.enabled=true
info.app.name=MinterCoder
info.app.description=My Project
info.app.version=1.0.1
Erişim için:
http://localhost:8080/actuator
http://localhost:8080/actuator/health
http://localhost:8080/actuator/info
Bütün actuators endpointleri
https://docs.spring.io/spring-boot/reference/actuator/endpoints.html#page-title