i woud disable actuator endpoints except health endpoint. docs describe how achieve in resource properties:
endpoints.enabled=false endpoints.health.enabled=true but have preferred use inline java configuration. please explain in application can configure same?
looking @ org.springframework.boot.actuate.autoconfigure.endpointautoconfiguration, endpoints provided when beans missing. 1 option provide them in own configuration class. endpoints have field enabled. provide of them, setting enabled on false, except 1 need.
@configuration public class actuatorconfiguration { @autowired(required = false) private collection<publicmetrics> publicmetrics; @bean public metricsendpoint metricsendpoint() { list<publicmetrics> publicmetrics = new arraylist<>(); if (this.publicmetrics != null) { publicmetrics.addall(this.publicmetrics); } collections.sort(publicmetrics,annotationawareordercomparator.instance); metricsendpoint metricsendpoint = new metricsendpoint(publicmetrics); metricsendpoint.setenabled(false); return metricsendpoint; } }
Comments
Post a Comment