在上一章节中,咱们学习了如何构建Spring Boot Admin Server应用程序。在本章节中,将学习如何让咱们的应用程序被Admin Server所管理。相对于Admin Server来讲,须要被管理的应用程序称为Admin Client。java
admin client须要在Maven build文件中添加以下的两个依赖:web
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
</dependency>
复制代码
在application.properties文件中配置应用程序的启动端口、应用名称和Admin Server的URL地址:spring
server.port=8081
spring.application.name=Admin-Client-1
spring.boot.admin.client.url=http://localhost:9091
management.endpoints.web.exposure.include=*
复制代码
使用下面的maven命令对应用程序进行打包:浏览器
mvn clean install
复制代码
打包成功后,使用入下的命令运行JAR文件:app
java -jar JARFILE
复制代码
最后,咱们还须要将Admin Server启动。maven
接下来,在web浏览器中输入URL:http://localhost:9091 访问Spring Boot Admin Server:spring-boot
应用监控详情页:学习
JVM监控页面:ui
应用实例信息页面:url
日志信息页面: