上QQ阅读APP看书,第一时间看更新
Exposing a custom Spring Boot Actuator endpoint
The @ReadOperation annotation will expose the Getter for the custom endpoint and the @WriteOperation will expose the Setter for the custom endpoint. The endpoint will be mapped under the http://<host>:<port>/actuator/custom URL (the default host is localhost, and the default port is 8080 unless configured otherwise) and also exposed as a JMX Management bean:
@Component
@Endpoint(id = "custom")
public class CustomEndpoint {
private final static Logger LOGGER =
LoggerFactory.getLogger(CustomEndpoint.class);
@ReadOperation
public String get() {
return "Custom Endpoint";
}
@WriteOperation
public void set(String message) {
LOGGER.info("Custom Endpoint Message {}", message);
}
}