Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/spring-boot/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 如何在基于spring boot(tomcat)的应用程序中记录可用/使用的线程数?_Java_Spring Boot - Fatal编程技术网

Java 如何在基于spring boot(tomcat)的应用程序中记录可用/使用的线程数?

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

是否有一个spring引导配置,您可以在其中记录应用服务器当前拥有的可用/已使用线程数?

您可以使用启动器框架

<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