Spring Boot Actuator is a sub-project of the Spring Boot Framework. It includes a number of additional features that help us to monitor and manage the Spring Boot application. It contains the actuator endpoints (the place where the resources live). We can use HTTP and JMX endpoints to manage and monitor the Spring Boot application.
// When accessing actuator end point, need to enter following
// username and pw
management.security.enabled=true
management.security.roles=ADMIN
security.basic.enabled=true
security.user.name=admin
security.user.passowrd=admin
// or
management.security.enabled=false
// Reveal all the api end points
management.endpoints.web.exposure.include: "*"
management.endpoint.health.show-details: always
Result (The api end points will be listed out)
Spring Boot Admin
Introduction
It is vue.js application on top of the Spring Boot Actuator endpoints that provide the ui to monitor the application with actuator
Implementation
// build.gradle
plugins {
id 'java'
id 'org.springframework.boot' version '3.0.5'
id 'io.spring.dependency-management' version '1.1.0'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'
repositories {
mavenCentral()
}
ext {
set('springBootAdminVersion', "3.0.2")
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-actuator'
implementation 'org.springframework.boot:spring-boot-starter-web'
// register the application to monitor
implementation 'de.codecentric:spring-boot-admin-starter-client'
// the server to host spring admin ui
implementation 'de.codecentric:spring-boot-admin-starter-server'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
}
dependencyManagement {
imports {
mavenBom "de.codecentric:spring-boot-admin-dependencies:${springBootAdminVersion}"
}
}
package com.example.demo;
import de.codecentric.boot.admin.server.config.EnableAdminServer;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@EnableAdminServer
public class DemoApplication {
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}