记一次SpringBoot升级2.x以后遇到的一个小坑:
以前采用1.x的时候,在服务发现中心点击单个服务,可以查看当前服务的详细信息,配置文件只需要简单的配置,
:
父级: <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.2.RELEASE</version> </parent> 子级: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId> </dependency>这样就可以在服务发现中心看到具体该服务的详细信息
升级2.x以后,需要再加一个服务依赖和更改一个服务配置:
pom.xml中增加:
<dependency> <groupId>de.codecentric</groupId> <artifactId>spring-boot-admin-starter-client</artifactId> <version>2.1.4</version> </dependency>yml文件中增加:
management: endpoints: web: exposure: include: '*' endpoint: health: show-details: ALWAYS这样就可以显示该服务的详细信息了