Java 如何在基于spring boot(tomcat)的应用程序中记录可用/使用的线程数?
是否有一个spring引导配置,您可以在其中记录应用服务器当前拥有的可用/已使用线程数?您可以使用启动器框架Java 如何在基于spring boot(tomcat)的应用程序中记录可用/使用的线程数?,java,spring-boot,Java,Spring Boot,是否有一个spring引导配置,您可以在其中记录应用服务器当前拥有的可用/已使用线程数?您可以使用启动器框架 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> 去http://localhost:8080/actu
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
去http://localhost:8080/actuator/metrics/ 您将看到所有可用的指标
例如,当前线程http://localhost:8080/actuator/metrics/tomcat.threads.current这是一个很好的观点,我知道执行器提供了很多功能,我将尝试一下。除了线程度量之外,是否可以禁用所有其他功能?```{“名称”:“tomcat.threads.current”,“baseUnit”:“threads”,“measurements”:[{“statistic”:“VALUE”,“VALUE”:10.0}],“availableTags”:[{“tag”:“name”,“values”:[“http-nio-8082”]}}非常感谢Simon。这样就可以了。我只需要排除安全类,因为我使用的是自定义类@SpringBootApplication(排除={SecurityAutoConfiguration.class,ManagementWebSecurityAutoConfiguration.class})
server.tomcat.mbeanregistry.enabled=true
management.endpoints.web.exposure.include=info,health,metrics