Spring Boot actuator interview questions and answers

More Java interview questions and answers...

1. What is the Spring Boot actuator?

An actuator is a tool with which we can monitor and manage our application. When the application is pushed into production it provides HTTP endpoints with which we can monitor and get metrics of our application. This monitoring and management information is exposed via REST-like endpoint URLs.

2. Which are the some of important and widely used actuator endpoints?

  • /actuator - provides a hypermedia-based discovery page for all the other endpoints
  • /env: Return list of properties in the current environment
  • /auditevents: Returns all auto-configuration candidates and the reason why they ‘were’ or ‘were not’ applied.
  • /health: Return application health information.
  • /beans: Returns a complete list of all the Spring beans in your application.
  • /dump: It performs a thread dump.
  • /trace: Returns trace logs
  • /metrics: It shows several useful metrics information like JVM memory used, system CPU usage, and much more.
  • /info: displays the public application info
  • /caches: Check available caches
  • /flyway - provides all the information about your database migration scripts

3. How to enable Spring Boot actuator to our application?

To enable Spring Boot Actuator, we just need to add the spring-boot-actuator dependency to our package manager.

Maven users can add the below dependency in your pom.xml file:

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>


Gradle users can add the below dependency in your build.gradle file

compile group: 'org.springframework.boot', name: 'spring-boot-starter-actuator'

4. What are the protocols we can use to access actuator endpoints?

Spring Boot allows us to access actuator endpoints using both HTTP and JMX

5. What is Health Indicator?

The HealthEndpoint of spring-boot-starter-actuator module collects Health information for any beans that are defined as HealthIndicator.This health information is accessible at the /health endpoint and can be consumed by monitoring software. By default, multiple Health Indicators are auto-configured.

6. What is the Health Indicator status?

Following are some of the common health indicator status:
  1. UP: The status UP indicates the application is running.
  2. DOWN: The status will show DOWN if any of those health indicator components are ‘unhealthy’ for example a database is not reachable.
  3. OUT_OF_SERVICE — The component is out of service temporarily
  4. UNKNOWN — The component state is unknown

7. What is the metrics in the actuator?

Image result for What are spring metrics for?
The /metrics endpoint shows several useful metrics information like JVM memory used, system CPU usage, open files, and much more.

8. What are some metrics monitoring tools?

9. What is loggers for?

The /loggers endpoint shows the application’s logs and also lets you change the log level at runtime.
These levels can be one of:
  • TRACE
  • DEBUG
  • INFO
  • WARN
  • ERROR
  • FATAL
  • OFF
  • null

10. What is beans for?

/beans return a complete list of all the Spring beans in your application.


Popular posts from this blog

Learn Java 8 streams with an example - print odd/even numbers from Array and List

Java Stream API - How to convert List of objects to another List of objects using Java streams?

Registration and Login with Spring Boot + Spring Security + Thymeleaf

Java, Spring Boot Mini Project - Library Management System - Download

ReactJS, Spring Boot JWT Authentication Example

Top 5 Java ORM tools - 2024

Java - Blowfish Encryption and decryption Example

Spring boot video streaming example-HTML5

Google Cloud Storage + Spring Boot - File Upload, Download, and Delete