我想向我的应用程序添加一个路径“localhost:8080/metrics”,以便Counter使用 Prometheus查看我的变量。我读到了一个 spring 启动应用程序,我需要主类上的唯一注释。
package hello;
import io.prometheus.client.spring.boot.EnablePrometheusEndpoint;
import io.prometheus.client.spring.boot.EnableSpringBootMetricsCollector;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
@EnablePrometheusEndpoint
@EnableSpringBootMetricsCollector
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
如何在没有@SpringBootApplication.
可以通过注册多个servlet来实现吗?
慕仙森
相关分类