We have seen that the Actuator provides several endpoints for your application. But Spring Boot's Actuator also allows you to create a custom endpoint by implementing the EndPoint interface. Let's see the following example:
package com.dineshonjava.sba; import java.util.ArrayList; import java.util.List; import org.springframework.boot.actuate.endpoint.Endpoint; import org.springframework.stereotype.Component; @Component public class MyCustomEndpoint implements Endpoint<List<String>>{ @Override public String getId() { return "myCustomEndpoint"; } @Override public List<String> invoke() { // Custom logic to build the output List<String> list = new ArrayList<>(); list.add("App message 1"); list.add("App message 2"); ...