今天尝试项目里面加入Spring Boot Admin,它是一个Web应用程序,用于管理和监视Spring Boot应用程序。它分为Server端和Client端,每个应用程序都被视为客户端并注册到管理服务器。实现的原理则是基于Spring Boot Actuator提供的端点。
搭建admin-server
1.pom文件引入相关依赖
<!-- 添加admin-server、admin-server-ui依赖 -->
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-ui</artifactId>
<version>2.0.1</version>
</dependency>
2.启动类添加注解@EnableAdminServer
3.启动服务出现下面错误信息
***************************
APPLICATION FAILED TO START
***************************
Description:
An attempt was made to call the method reactor.retry.Retry.retryMax(I)Lreactor/retry/Retry; but it does not exist. Its class, reactor.retry.Retry, is available from the following locations:
jar:file:/D:/mymaven/repository/io/projectreactor/addons/reactor-extra/3.2.0.RELEASE/reactor-extra-3.2.0.RELEASE.jar!/reactor/retry/Retry.class
It was loaded from the following location:
file:/D:/mymaven/repository/io/projectreactor/addons/reactor-extra/3.2.0.RELEASE/reactor-extra-3.2.0.RELEASE.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of reactor.retry.Retry
项目没能启动就报错,查看错误信息。大概意思:“尝试调用方法reator . retry.retry.retrymax (I)Lreactor/retry/ retry;但它并不存在。它的类,reactor.retry。重试,可在以下地点下载:下面就是两个下载地址”。上网查找相关报错信息发现根本原因就是pom.xml文件中版本依赖有问题。查看我spring boot版本信息:2.1.0.RELEASE,于是将spring-boot-admin-server也升级版本
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-ui</artifactId>
<version>2.1.0</version>
</dependency>
再次启动成功,特此记录!