This is my fifth day of the August More Text Challenge. Check out the details: The August More Text Challenge is described in some places as the four Components, in others as the Four core principles, and in some places as the Four Artifacts. Personally, I think it’s more appropriate to call the artifact. Now describes the Actuator monitoring management, and Spring Boot CLI command line tools.

1. Manages THE Actuator monitoring

1.1 introduction

Actuator is a very powerful feature of Spring Boot. It enables application monitoring management, such as helping us gather application performance, monitoring application health, and displaying HTTP trace request information. It is an essential link for us to build the micro-service architecture and guarantee the stable operation of the whole system.

1.2 Integration Procedure

  1. To integrate Actuator in SpringBoot, just add the following dependencies to THE POM.xml:
<dependency>
	<groupId>org.springframework.boot</groupId>
	<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
Copy the code
  1. configuration

There are many endpoints built into the Actuator system that allow you to access different monitoring information. By default, only health and INFO endpoints are enabled on Actautor. You need to configure the application.yml file:

management:
  endpoints:
    web:
      exposure:
        include: The '*'
Copy the code

The ‘*’ indicates that all endpoints are enabled. You can also turn on specified endpoints:

management:
  endpoints:
    web:
      exposure:
        include: health,info,httptrace
Copy the code

The preceding configuration indicates that the health, INFO, and HttpTrace endpoints are enabled. Start the program at this time to visit http://localhost:8080/actuator/health, will see the results as follows.

{"status":"UP"}
Copy the code

UP indicates that the system is running properly.

2. Spring Boot CLI tool

Spring Boot CLI(Command Line Interface) is a Command Line tool for quickly building Spring-based prototypes. It supports running Groovy scripts, which means you can have a Java language-like syntax without much boilerplate code. Using Spring Boot through the CLI is not the only way, but it is the fastest way to get Spring applications built.

2.1 installation

Download address repo. Spring. IO/release/org… Configuring Environment Variables

  1. Set spring.bat to the environment variable

  1. Open CMD, enter Spring –version, view the current version number, complete the installation

2.2 the use of

If you’re not familiar with Groovy, you can write a Java Controller directly.

@RestController
public class AdviceController {
	@RequestMapping("/")
	public String hello(a){
		return "hello world!"}}Copy the code