Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to use Admin in SpringBoot

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/02 Report--

This article is to share with you about how to use Admin in SpringBoot. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article.

What is SpringBoot Admin?

Spring Boot Admin is an application that manages and monitors your Spring Boot applications. These applications are registered through Spring Boot Admin Client (via HTTP) or discovered using Spring Cloud (for example, Eureka). UI is just an AngularJs application on the Spring Boot Actuator endpoint.

Quick start

First, create a SpringBoot project in IDEA as the server side. The project is as follows:

Then introduce dependencies into pom.xml:

De.codecentric spring-boot-admin-server 1.5.6 de.codecentric spring-boot-admin-server-ui 1.5.6

Continue to introduce the annotation @ EnableAdminServer in the startup class SpringbootAdminApplication.java, and then run the project:

Simply visit http://localhost:8084/:

At this point, you will find that there is no application information.

Next, we create a new SpringBoot project and use it as a client program. The project is as follows:

Add dependencies in pom.xml:

De.codecentric spring-boot-admin-starter-client 1.5.6

Then set it in application.yml:

Spring.boot.admin.url=http:localhost:8094 is used to register the current application with Spring Boot Admin.

You can also set spring.boot.admin.client.name: (the name of the application) if it is not set, there will be a default name

At this point, run two projects:

Click the detail button in the figure: you can see the application's health value, memory, JVM, GC, and so on.

Metrics Information:

Environmental Information:

Log Information:

JMX Information:

Thread information:

Trace tracking information:

You can also download the Heapdump file.

There is a red X at the back of the app list on the home page. We can remove the registered app, but as long as you don't stop the app, it will register again immediately.

In addition, the version and info of the application list are blank in the figure above. Let's see how to change it:

Info.groupId: @ project.groupId@info.artifactId: @ project.artifactId@info.version: @ project.version@

Rerun the client program and refresh the page to find:

You can also query the event changes for the application:

Client application JMX bean management

To interact with JMX-beans in the administrative interface, you must include Jolokia in your client application

Pom.xml join dependency:

Org.jolokia jolokia-core above is how to use Admin in SpringBoot. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report