Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to check the health of embedded tomcat in spring boot application?

Anyone know how to get information of incoming threads / queue size? I want to include it in health check (class extending AbstractHealthIndicator).

like image 928
Ondřej Stašek Avatar asked Jan 31 '18 04:01

Ondřej Stašek


People also ask

How do you check health of application in Spring Boot?

Checking the Health of Individual Components Creating a custom health indicator is done in two steps: Implement the HealthIndicator interface and override the health() method. Register the health indicator class as a Spring bean by adding the @Component annotation (or by using Java Config).

How do I know if Tomcat is running in Spring Boot?

A simple way to see if Tomcat is running is to check if there is a service listening on TCP port 8080 with the netstat command. This will, of course, only work if you are running Tomcat on the port you specify (its default port of 8080, for example) and not running any other service on that port.

Is Tomcat embedded in Spring Boot?

Spring Boot is a popular Java-based framework to develop microservices. By default, the Spring Tool Suite (STS) IDE -- which is used to build a Spring Boot application -- will automatically create an embedded Tomcat server with the microservices developed each time a build or deployment occurs.

Which version of Tomcat is embedded in Spring Boot?

Tomcat 7 & 8.0 work with Spring Boot, but the default is to use Tomcat 8.5. If you cannot use Tomcat 8.5 (for example, because you are using Java 1.6) you will need to change your classpath to reference a different version.


1 Answers

You can use Actuator and Micrometer to get data about tomcat in spring boot. But if you want information about Thread you must configure more in spring boot config file.

server.tomcat.mbeanregistry.enabled=true

like image 159
Wachira Avatar answered Sep 21 '22 17:09

Wachira