Looking at org.springframework.boot.actuate.autoconfigure.EndpointAutoConfiguration, the endpoints are provided when the beans are missing. One option would be to provide them in your own configuration class. All endpoints have the field enabled. You could provide all of them, setting enabled on false, except for the one you 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;
}
}