Spring Boot non-WEB projects use actuator

I would like to ask how to use actuator, in non-WEB projects, such as some message consumption services, background job services. There is no need to have WEB function, how to use actuator in this case, can it be connected to Spring Boot Admin?

Jul.08,2021

The

method is the same as the method with web.

first, add dependencies on actuator and spring boot admin in pom.xml :

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-client</artifactId>
        </dependency>

then, add the address of spring boot admin to the application.yml file:

spring:
  boot:
    admin:
      client:
        url: "http://localhost:8080"

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